LoginSignup
6
6

More than 5 years have passed since last update.

【Unity拡張】Unityエディタを再起動させる

Last updated at Posted at 2016-08-04

はじめに

エディター拡張を作っていると、Unityを再起動させるというシチュエーションがよく発生します。

楽してUnityを再起動させたい、ということで作ってみました。

ソースコード

EditorRestartUnity.cs
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Diagnostics;

public class EditorRestartUnity
{
    [MenuItem("File/Restart")]
    static void RestartUnity()
    {
        // 別のUnityを起動したあとに自身を終了
        Process.Start(EditorApplication.applicationPath);
        EditorApplication.Exit(0);
    }
}

実行する

上記のスクリプトをプロジェクトに追加すると、 File/Exit の下にRestartが追加されます。
image
RestartをクリックするとUnityが再起動します。 

楽してUnityが再起動できるようになりました(完

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6