Can you refrence something and check via tag?

Hey! While watching the lesson I wondered, what if we need to check for a tag without a collision so we can’t access each other? Can we reference a game object and check its tag by accessing it via the reference? Heres an example
[SerializeField] gameObject car;
if(car.tag == “moving”) { do smth};
Thanks a lot!

Hi Gamer089,

As long as you have a reference to the game object whose tag you want to check, you can check its tag.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms