I want to access a game component’s script that has a public boolean, then I want to check if it’s true or false. What’s the correct syntax? I tried…
if (gameObject.GetComponents<MyScript>().MyBoolean == false)
But it didn’t work.
I want to access a game component’s script that has a public boolean, then I want to check if it’s true or false. What’s the correct syntax? I tried…
if (gameObject.GetComponents<MyScript>().MyBoolean == false)
But it didn’t work.
Try the singular version, GetComponent and not GetComponents.