Answer the question
In order to leave comments, you need to log in
How to turn off a child object in a newly created object?
In one script, I create an object from a prefab, inside of which there are a bunch of child objects, and among them there is 1 that I need to turn off. How is it implemented? How can you refer to a child object just created?
Answer the question
In order to leave comments, you need to log in
It would be more convenient if you threw off the script that creates this object.
But alternatively you can use the following script:
var object = Instantiate(Prefab, transform, false);
object.transform.GetChild(номер дочернего элемента который нужно выключить)gameObject.SetActive(false);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question