Anything wrong with this script?

Hello everyone I have a 3D object which is an airplane, I want it to have about 3 lives, and re spawns when dies in a certain point that works fine everything is working fine but 1 thing, which is when it dies it doesn’t disappear even after the particle works which is the explosion one?

here’s the script and the object picture

using UnityEngine;
using System.Collections;

public class LevelManager : MonoBehaviour {
   
    public GameObject currentCheckpoint;
    public GameObject deathParticle;
    public GameObject respawnParticle;
    public GameObject bulletbonus;
   
    private PlayerController player;
    public int pointPenaltyOnDeath;
    public float respawnDelay;
    public HealthManager healthMnager;

    void Start ()
    {
        player = FindObjectOfType<PlayerController> ();
        healthMnager = FindObjectOfType<HealthManager> ();

    }
   
    void Update ()
    {

    if (player.enabled == false)
        {
            Destroy(GameObject.FindGameObjectWithTag("MonsterBulletSystem"));
            Destroy(GameObject.FindGameObjectWithTag("EnemyMissile"));
            Destroy(GameObject.FindGameObjectWithTag("Enemy"));
            StopSuperShooter();

        }
    }
   
    public void RespawnPlayer()
    {
        StartCoroutine ("RespawnPlayerCo");
    }
   
    public IEnumerator RespawnPlayerCo()
   
    {
        Instantiate (deathParticle, player.transform.position, player.transform.rotation);
        player.enabled = false;
        player.GetComponent<MeshRenderer> ().enabled = false;
        //ScoreManager.AddPoints (-pointPenaltyOnDeath);
        Debug.Log ("Player Respawn");
        yield return new WaitForSeconds (respawnDelay);
        player.transform.position = currentCheckpoint.transform.position;
        player.enabled = true;
        player.GetComponent<MeshRenderer> ().enabled = true;
        healthMnager.FullHealth();
        healthMnager.isDead = false;
        Instantiate (respawnParticle, player.transform.position, player.transform.rotation);
       
    }

    void StopSuperShooter ()
    {
        bulletbonus.gameObject.SetActive(false);
    }
   
}

2209672--146878--Object.PNG

Thanks in advance, what I need is to .enable false and I already set the meshrenderer to be false.

I did not try this but I’m guessing since I can’t see any other scripts, but from what I can see, your delay is not very long… I don’t see any amount… Maybe set the repawn delay to 10-20seconds. I will try and test this later…

From what I can tell its respawning right away. so fast that really you can’t see it… I had this happen years ago… but everything else looks ok but I have not tested it…

It’s actually set to 5s, which should be fine but I don’t think it’s working, however thanks a lot!

you’re only disabling the meshrenderer at the top level in the hierarchy (assuming the GameObject “Player” has the PlayerController script attached to it)

You need to disable all the meshrenderers for the all constituent parts of your player model

If your system allows you to disable the logic that is on player, try deactivating its gameObject (or parenting it with a deactivated gameObject). You’ll get rid of the rendering in the whole hierarchy without having to worry about every single object individually. (same method you used in StopSuperShooter(), player.gameObject.SetActive(false) should do the trick)

If you have particles that doesn’t disappear, try this:

this.GetComponent<ParticleEmitter>().ClearParticles();