Hi,
I have a popup-manager singleton, which creates itself first time you want to show a popup. It has some settings, which I would like to set in the inspector, but they don’t show up (except for one, but that one is reset to it’s default when the singleton object is created).
I have to following code:
static UnityGrowl m_Instance;
static readonly object padlock = new object(); //For thread safety
//Creates the Popup Object only once, the first time it is needed
public static UnityGrowl Instance
{
get
{
lock (padlock)
{
if(!m_Instance)
m_Instance = (new GameObject("Unity Growl")).AddComponent<UnityGrowl>();
return m_Instance;
}
}
}
//GUISkin shows up in the inspector, but is Null in the object in the scene
//The other stuff doesn't even show up in the inspector
public GUISkin m_GUISkin;
GUIStyle m_Style;
public int m_Width = 240;
public int m_XOffset = 5;
public int m_YOffset = 5;
public enum position{TopLeft, TopRight, BottomLeft, BottomRight}
public position m_Position = position.TopRight;
When I say “doesn’t show up in the inspector” I mean it doesn’t for the script (when not attached to an object), when I make my first popup and look at the ‘Unity Growl’ object it does show the settings.
Is it possible to make it so that the settings do show up for the script itself, and they don’t get reset ?
Thanks !
-P