[Solved] Unity 2018 Projectile.cs Lasers not destroying themselves

I’m not sure if this was covered already as I have used the search function and couldn’t find a solution.

From namespace on,

public class Projectile : MonoBehaviour {

public float damage = 100f;

public float GetDamage()
{
    return damage;
}

public void Hit() 
{
    Destroy(gameObject);
}

}

on the last method I am assuming that this is where the lasers are supposed to destroy themselves after contact but they don’t seem to be doing so?

EDIT: Fixed. Line missing from EnemyBehavior.cs which registered the Hit().

Any help appreciated thanks!

Privacy & Terms