- Home /
Question by
davidhorak · May 29, 2013 at 07:48 AM ·
listeditorwindowsingletoncollections
Editor window set Singleton List
Hi how i can set List in sigleton ?
I have class:
// Singleton, only one must exist in scene
private static GuiLayers _instance = null;
public static GuiLayers instance {
get{
// In GuiLayers is not yeat created
if(!_instance){
// Try get JobManger object in scene
_instance = FindObjectOfType(typeof(GuiLayers)) as GuiLayers;
// If is not is scene
if(!_instance){
// Create a new one
var instance = new GameObject("GuiLayers");
_instance = instance.AddComponent<GuiLayers>();
}
}
return _instance;
}
}
public int ActiveLayer = -1; // This set working fine
public List<GameObject> GuiGameObjects = new List<GameObject>(); // This collection is always null
In my custom window editor i select the GO with GuiLayers script, and I set the ActiveLayer and GuiGameObjects.
Them if i Play, the ActiveLayer is set but GuiGameObjects is null. Where is the problem ?
Comment