I am making a respawn effect for my player and I have 2 issues.
The first is that the particle plays when the scene loads, despite the toggle being off as shown here:
Secondly, after it plays on awake, it then destroys itself, so when I attempt to play it in the following script, it won’t load and crashes the game with a red issue.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class KillZone : MonoBehaviour
{
public ParticleSystem respawn;
public GameObject playerObj;
void OnTriggerEnter(Collider col)
{
if (col.gameObject.tag == "Player")
{
col.gameObject.GetComponent<CharacterControls>().LoadCheckPoint();
respawn.transform.position = new Vector3(playerObj.transform.position.x, playerObj.transform.position.y + 1, playerObj.transform.position.z);
respawn.Play();
}
}
}
Thanks - turned out it wasn’t this. For the prefab settings I had to set the destroy mode to disable not destroy after use.
To fix the thing happening at the start, I just disabled the game object and enabled it when triggering the effect
I’m going to document this in several posts in case someone else runs into the same issue. After Unity 6, I noticed that without a script, without a loop, and without play on awake, some particle systems was still running every time I pressed play.
The solution is to set “Simulate Layers” in the popup dialog to “Nothing,” uncheck “Resimulate,” and then click “Stop.” Deselect the Game Object.
Every time you select a Game Object that directly has a particle system embedded, it will play in the editor and cause the problem. If the particle system is on a child object, you can select the parent without any issue.