LoginSignup
0
0

More than 5 years have passed since last update.

[Unity] エラーが出たらEditorWindowで作った画面を開くようにする

Posted at
ErrorReceivedWindow.cs
public class ErrorReceivedWindow : EditorWindow
{
   //1回だけ呼び出したいので画面を開いたときに呼び出す
   [InitializeOnLoadMethod]
   private static void _onInit()
   {
        //ログが更新されたら呼び出すようにEイベントを登録
        Application.logMessageReceived += ApplicationOnLogMessageReceived;
   }

   private static void ApplicationOnLogMessageReceived(string condition, string stacktrace, LogType type)
   {
       //エラーが出たら画面を開く
       if (type == LogType.Exception)
       {
           GetWindow<ErrorReceivedWindow>();
       }
   }
}
0
0
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
0
0