Hi guys. I can’t get the Particle System to instantiate after the Enemy hits the Player… I get “The thing you want to instantiate is null” but I don’t get why.
using UnityEngine;
using System.Collections;
public class Hit : MonoBehaviour {
Vector3 OriginalPosition;
Vector3 LastPosition;
// Use this for initialization
void Start () {
OriginalPosition = transform.position;
LastPosition = transform.position;
}
// Update is called once per frame
void OnCollisionEnter (Collision col) {
if (col.gameObject.name == "Enemy") {
gameObject.GetComponent<Renderer> ().enabled = false;
gameObject.GetComponent<Collider> ().enabled = false;
Instantiate(Resources.Load("DeathErupt") as ParticleSystem, LastPosition, Quaternion.identity );
}
}
}