I am using this code…
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class TextManager : MonoBehaviour
{
private static TextManager instance;
public static TextManager Instance
{
get
{
if (instance == null)
{
instance = new GameObject ("TextManager").AddComponent<TextManager> ();
}
return instance;
}
}
void Start()
{
Letters = new List<GameObject>();
}
public static List<GameObject> Letters;
public static GameObject MakeWord(string Text)
{
char[] letrs = Text.ToCharArray();
foreach(char letr in letrs)
{
foreach(GameObject letter in Letters)
{
if(letter.name == letr.ToString())
Debug.Log(letr);
}
}
return null;
}
void OnDisable()
{
instance = null;
}
}
I drop the script on a game object so I can add meshes I am using as 3d text to it.
But, the list does not show up on the object for drag’n’drop. I have used singletons before in c# but not in unity, am I doing it wrong? Or can I not use static lists of game objects? or? There are no errors, the list simply does not show up in the editor.
PS. I have edited this thing three times and cant get the code to show up correctly.