- Home /
Public list are not reflecting in inspector.
I am a beginner at this, I don't understand what is wrong within this code, the list is public still it is not reflecting in the inspector section.
public string theLevel;
public GameObject InputField;
public GameObject TextDisplay;
private int lvl_int_value;
public List<GameObject> charcaterselectbutton;
public List<GameObject> unlockatlevel;
public void StoreLvl()
{
theLevel = InputField.GetComponent<Text>().text;
TextDisplay.GetComponent<Text>().text = theLevel;
lvl_int_value = int.Parse(theLevel);
for (int i = 0; i < charcaterselectbutton.Count; i++)
{
if (lvl_int_value >= 50)
{
charcaterselectbutton[i].SetActive(true);
unlockatlevel[i].SetActive(false);
}
}
}
}
Answer by DialBlitzness · Aug 10, 2020 at 07:01 AM
Hello !
By copying your script at home, everything works :
Did you forget to save your script? If this is the case, the changes are not taken into account by Unity. Otherwise, it could come from the value of "Size" that you left at zero. You have to increase it, then drag in the gameObjects you want. And the last error I can see is that your script has errors, and the Unity console is telling you what to fix before loading it.
You can also drag a gameobject / multiple gameobjects onto the list name and the Unity editor will add those at the end of the list / array.