Chapter 8 Finishing touches MarineDeathParticles

I am adding in the deathparticles and the alien properly displays upon death however the marine upon dying doesn’t display. I changed the private Deathparticle variable in the marine to see it was setting correctly then changed it back. I used print statements to make sure it was being called correctly from the marine and it is.

It’s collision is setup as the book describes and the render is set to the foreground layer.

The MarineDeathParticle object has the death particle script on it and it is being called by the player controller script.

Hi skywignedace, I was having the same issue and noticed that what is missing is to add the following code deathParticles.transform.parent = null; before deathParticles.Activate (); in the player controller, without this the particles get destroyed with the gameobject.

Hope this helps.

Thanks! That does cause the particles to render! However it leaves us with a floating pool of blood :frowning: I wasn’t expecting to make a poltergeist haha. Is there away for the particles to ignore the player layer and continue working?

Hahaha you have a good point :stuck_out_tongue_closed_eyes:, I’m no sure if this is the intended result or we are missing something :thinking:

I tried the finished project but it has an error in the script (not assigning the gameObject.GetComponentInChildren(); to a variable) however the game runs but without the blood splash.

Unfortunately, I’m a beginner and don’t know how to fix it


public void Die() {
	bodyAnimator.SetBool("isMoving", false);
	marineBody.transform.parent = null;
	marineBody.isKinematic = false;
	marineBody.useGravity = true;
	marineBody.gameObject.GetComponent<CapsuleCollider>().enabled = true;
	marineBody.gameObject.GetComponent<Gun>().enabled = false;	
	deathParticles.transform.parent = null;
	deathParticles.Activate ();
	head.transform.parent = null;
	head.useGravity = true;