,So I’m working on a 2D platformer, and I got stuck somewhere.
I have set up a particle system, one that will show when the player dies and one that will show when the player respawn, the script is EXACTLY as the one in the tutorial that I’m following: Particle Effects! - Unity 2D Platformer Tutorial - Part 5 - YouTube
But my particles won’t show on the player when he dies. They will be shown on the default spot that they were created.
Like this: Recordit: Record screencasts fast & free! with GIF Support!
I already deleted them from there, and I think that the death particle should be attached to the player or something so it can follow the player and play when he dies.
And the respawn particle should be attached to the checkpoints.
In the video the guy does nothing about that but they work.
Any help? Please, I’ve been struggling on this for a couple of hours and it’s already frustrating
The script:
using System.Collections;
using UnityEngine;
public class LevelManager : MonoBehaviour {
public GameObject currentCheckpoint;
private PlayerController player;
public GameObject deathParticle;
public GameObject respawnParticle;
// Use this for initialization
void Start () {
player = FindObjectOfType<PlayerController>();
}
// Update is called once per frame
void Update () {
}
public void RespawnPlayer()
{
Instantiate (deathParticle, player.transform.position, player.transform.rotation);
Debug.Log ("Player Respawn");
player.transform.position = currentCheckpoint.transform.position;
Instantiate(respawnParticle, currentCheckpoint.transform.position, currentCheckpoint.transform.rotation);
}
}
Please help me