I know how to use this
public GameObject object;
void Awake{
object.SetActive(false)
}
But then what if I have a script in there? Or if I have multiple objects in there?
If anyone finds out please tell me, Thank you.
I know how to use this
public GameObject object;
void Awake{
object.SetActive(false)
}
But then what if I have a script in there? Or if I have multiple objects in there?
If anyone finds out please tell me, Thank you.
You can only turn off the renderer component.
Just deactivate the renderer component(s) instead. Or add it to a layer the camera cant render. There are different ways to achieve this. Which one to pick depends on your circumstances, but in the end they all work.
Ok thank you for all the advice!
I like to put anything visual on a child GameObject. Then I can turn on/off the child without issue if needed.
If this object is UI, sometimes I will use a Canvas Group component and set its alpha to 0.
https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/class-CanvasGroup.html