I am creating a simple platformer. When the player collides with the ground he respawns at the begening of the level. I also want a short little particle system to trigger and shoot out from him. I decided to write that part in the same script as the respawning. I can’t get it to work though. I hope someone can help. (The respawning works fine, just need help with particle system) (C#)
using UnityEngine;
using System.Collections;
public class KillZone : MonoBehaviour {
GameObject player;
Vector3 respawn;
var particle ParticleSystem;
void Start () {
player = GameObject.Find ("Player");
respawn = GameObject.Find ("Respawn").transform.position;
}
void OnTriggerEnter2D (Collider2D col) {
Debug.Log ("Killzone Collision Detected");
particle.Play ();
player.transform.position = respawn;
}
}