- Home /
This question was
closed Mar 26, 2015 at 10:15 AM by
Digital-Phantom for the following reason:
The question is answered, right answer was accepted
Question by
Digital-Phantom · Mar 26, 2015 at 10:08 AM ·
instantiatecolliderdestroyontriggerenterif statement
Only 1 of 3 conditions being executed in IF statement?(Solved)
This one got me confused. Why is only the 3rd part of the IF statement being executed ?
void OnTriggerEnter (Collider other)
{
if (other.tag == "Shot")
{
Destroy(other.gameObject);
Instantiate(invaderExplosion, transform.position, transform.rotation);
Destroy(gameObject);
}
It obviously recognises the projectile(Shot) otherwise the trigger wouldn't destroy the object as in part 3 of the IF statement. So why then does it not destroy the 'Shot' or play/instantiate my effect.
???
Comment
Best Answer
Answer by Digital-Phantom · Mar 26, 2015 at 10:14 AM
OK that was weird. Closing and reopening unity(5) solved the issue and all works fine now !
???? go figure !