So im following the Space Shooter tutorial and i keep getting a warning message that says:
The referenced script on this Behaviour is missing!
UnityEngine.Object:Instantiate(Object, Vector3, Quaternion)
DestroyByContact:OnTriggerEnter(Collider) (at Assets/Scripts/DestroyByContact.cs:14)
when i click on it, it takes me to my code and highlights the line
Instantiate(explosion, transform.position, transform.rotation);
Everything still works and i was able to continue but this message keeps popping up and i dont know why. Its irritating me. Any answers?
Heres my whole script:
using UnityEngine;
using System.Collections;
public class DestroyByContact : MonoBehaviour
{
public GameObject explosion;
public GameObject playerExplosion;
void OnTriggerEnter(Collider other) {
if (other.tag == "Boundary")
{
return;
}
Instantiate(explosion, transform.position, transform.rotation);
if (other.tag == "Player")
{
Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
}
Destroy(other.gameObject);
Destroy(gameObject);
}
}
Like i said, it all appears to be working just fine. My little ship shoots and hits asteroids and all that good stuff, but evidently something is wrong...
↧