I'm trying to increment an integer when it is near another gameObject. I am still a beginner, so raycasting didn't seem like a good idea because I don't want to use a straight line, and capsule casts are out of my depth. I thought I could use a trigger instead with OnTriggerStay.
In this instance there are only two gameobjects, a Billboard and Player. This script is attached to the Billboard gameobject. I just wanted to test and see if it is working but something is obviously seriously wrong, so I want to post here to figure out what is going wrong and how to fix it.
void OnCollisionStay(Collider other)
{
if (other.gameObject.CompareTag("Player"))
{for (int i = 1; i <= 100; i++)
print (i);
}
}
I've tried to look for this answer elsewhere but I couldn't find it. If I have made some mistake in posting here, please help me understand why. Thank you!
↧