i put 2 gameobjects(A and B) in my scenes and set the component box collider.
then i make A move forward B with script,and add the following script to B:
function OnTriggerEnter (col : Collider)
{
print("sth in!");
}
function OnTriggerExit (col : Collider)
{
print("sth out!");
}
function Reset ()
{
collider.isTrigger = true;
}
@script RequireComponent(BoxCollider)
and i hope when the A entered B, CMD show:“sth in”.
but when my A entered.nothing happened.
ps:
- i already add the box collider to A and B and set the B’s Trigger checked!
- when my First Person entered B.CMD show "sth in!"correctly!
why?!