(not sure if this belongs here or in the support foum; mods, please move this toppic if necessary)
Hi there
I have a custom editor window for my Grid Framework extension and the user can drag&drop an object into a field to use a grid for aligning. Now, if the user enters play mode with the “Maximize On Play” option turned on the field resets. It doesn’t reset if that option is turned off. Is this a bug or am I missing something? I can’t use EditorPrefs because the grids only exist within one scene each. Or can I? The documentation is pretty vague when it comes to editor scripting.
here is the relevant part of my editor window class
using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
using System;
public class GFGridAlignPanel : EditorWindow {
GFGrid grid;
Transform gridTransform;
[MenuItem("Window/Grid Align Panel")]
public static void Init(){
GetWindow(typeof(GFGridAlignPanel), false, "Grid Align Panel");
}
void OnGUI(){
grid = (GFGrid) EditorGUILayout.ObjectField("Grid:", grid, typeof(GFGrid), true);
if(GUI.changed grid){
if(grid){
gridTransform = grid.transform;
} else{
gridTransform = null;
}
}
...
}
void Update(){
...
}
...
}
(the omitted parts are just the various methods I call when buttons get clicked)
GFGrid is the grid component, it inherits straight from monoBehaviour, so all the user needs to do is drop a GameObject that has a grid as component into the field.