Hi,
I want to change the text on a sub-component of an instanced prefab.
I do:
- GameObject levelItemInstance;
-
- levelItemInstance = Instantiate(levelItem);
- levelItemInstance.transform.localScale = new Vector3(1f, 1f, 0);
-
- levelItemInstance.transform.Find(“levelName”).GetComponent().text = “WWWW”;
levelItem has many childs and those also has childs (one of them is levelName). I’m doing correctly?
I got this error (on line 6):
- NullReferenceException: Object reference not set to an instance of an object
Thanks for your help