Like my Question, what am i doing wrong? I feel like i read every post so far but really nothing helped…
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Collections.Generic;
[Serializable]
public class QuestEditor : EditorWindow
{
//[SerializeField]
//public List<QuestEditorNode> Nodes;
[SerializeField]
private int x;
void OnEnable()
{
Debug.Log("OnEnable " + x);
x = 42;
}
void OnDisable()
{
Debug.Log("OnDisable");
x = 66;
}
#region Unity Menu Tab
[MenuItem("Quest Editor/Show Window")]
public static void ShowWindow()
{
EditorWindow.GetWindow<QuestEditor>();
}
#endregion
}
i compressed it hard now. like you see in the first Line my attempt is to save a list of Nodes. But since this x saving doesn’t even work, i don’t care about my Nodes for now…
My Code should do nothing more to just save this x when my EditorWindow is closed. I read that this should be done by just adding [Serializable]
and [SerializeField]
to the class/variables…