Is this in the bullet script? Make sure both the player and bullet have the Player tag. Also, use CompareTag() instead...
void OnTriggerEnter2D( Collider2D other )
{
// Not the player?
if ( !other.CompareTag( "Player" ) )
{
// Get rid of this game object
Destroy( gameObject, 0.01f );
}
}
↧