Player explosion particles not working?

The player particles aren’t playing when I hit something with my ship… but it will print to the console.

CollisionHandler.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement; // ok as long as this is the only script that loads scenes

public class CollisionHandler : MonoBehaviour
{

    [Tooltip("In seconds")] [SerializeField] float levelLoadDelay = 1f;
    [Tooltip("FX prefab on player")] [SerializeField] GameObject deathFX;

  

    void OnTriggerEnter(Collider other)
    {
        StartDeathSequence();
        deathFX.SetActive(true);
        print(deathFX);
       
        Invoke("ReloadScene", levelLoadDelay);
    }

    private void StartDeathSequence()
    {
        SendMessage("OnPlayerDeath");
       
    }

    private void ReloadScene() // string referenced
    {
        SceneManager.LoadScene(1);
    }
}

Hi,

Is “Play On Awake” enabled in the Explosion particle system?

yes, play on awake is on.

Check which game object is assigned to the deathFX variable in the Inspector of the CollisionHandler component in your Hierarchy. It must be the Explosion game object from your Hierarchy, not the prefab in your Assets folder.

Furthermore, the parent game object may not get destroyed before the particle system is done emitting its particles.

Thanks! It turned out, that my deathFX variable in the inspector of the CollisionHandler component was pointing to the prefab and not the instance on the ship.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms