Hi,
I have the following class:
public class TileType : MonoBehaviour
{
private static List<TileInfo> TileInfoList = new List<TileInfo>
{
new TileInfo(0, "Blank", new GUIContent("Blank"), "Tiles/_BlankTile/BlankTile"),
//More new TileInfo's are made here
};
// The GUIContent list will be filled in automaticly based on the TileInfoList
public static GUIContent[] GUIContentList;
//Fill in some information automaticly !
void Awake ()
{
//Create GUIContent list
GUIContentList = new GUIContent[TileInfoList.Count];
for(int i = 0; i < TileInfoList.Count; ++i)
{
GUIContentList _= TileInfoList*.GuiContent;*_
_*}*_
_*}*_
_*//Some more irrelevant get methods*_
_*```*_
_*<p>As you can see I copy all the GUIContent from my TileInfoList into an array which only has the GUIContent (this is useful to draw a button grid ;) ). I let it GUICOntentList be filled in automatically to make sure it has the same order as my TileInfoList.</p>*_
_*<p>Now the problem is that the Awake() method only gets called when the script is attached to an object, which is not ideal. Also because of this I can't make the class static (just it's methods & variables :( ).</p>*_
_*<p>So my question is: is there a way to lat the GUIContentList be filled in automatically in a static class ? So I don't have to attach the script to an object, neither let it inherit from MonoBeheviour.</p>*_
_*<h2>Thanks !</h2>*_
_*<p>-Pablo</p>*_