I am trying to test that my trigger can recognize an object in it by its tag. The tag is on my player object and the script below is attached to the same game object as my trigger. When I run the game the word “Gravity” is printed in the console whenever my player is within the trigger, but “Tag is correct” is not. What do I need to do to get it to print?
-
void OnTriggerStay(Collider ob) {
print (ob.tag); if (ob.tag == "Gravity") { print ("Tag is correct"); }
}