I want to deactive all the canvases in the scene (that aren’t children) and activate the one in a gameObject variable
I know about Object.FindObjectsOfType<Canvas> but I can’t change their active since it’s not a gameObject
I want to deactive all the canvases in the scene (that aren’t children) and activate the one in a gameObject variable
I know about Object.FindObjectsOfType<Canvas> but I can’t change their active since it’s not a gameObject
Every component has a .gameObject property.
Just be aware that the FindObjectsOfType method is very slow.
foreach (var canvas in FindObjectsOfType<Canvas>())
canvas.gameObject.SetActive(false);