Help us understand the problem. What is going on with this article?

【Unity】EditorWindowのファイル名とクラス名が異なるとUnity起動時に "Error while reading window layout" が出る

More than 3 years have passed since last update.

環境

Unity 5.5.0f3 (Windows 10)

はじめに

EditorWindowを作っていたら、こんなエラーが出ました。

image

なんだこれ.

エラーの原因

EditorWindowクラス名とcsファイル名が一致しない場合に発生するエラーのようです

エラーを再現してみる

以下のEditorWindowを開いたままUnityエディターを再起動するとエラーが発生します。

HogeWindow1.cs
using UnityEditor;

public class HogeWindow : EditorWindow
{
    [MenuItem("EditorWindow/HogeWindow")]
    static void Open()
    {
        GetWindow<HogeWindow>();
    }
}

csファイル名とクラス名が異なる文字列になっているところがポイントです

エラー解決

EditorWindowクラス名とファイル名を同じものにすればエラーが出なくなります。(完)

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away