# NullReferenceException in chapter 8

**URL:** <https://forums.kodeco.com/t/nullreferenceexception-in-chapter-8/26951>\
**Category:** Unity Games by Tutorials\
**Created:** [March 7, 2017, 6:20am UTC](https://forums.kodeco.com/t/nullreferenceexception-in-chapter-8/26951 "2017-03-07T06:20:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![diegojerez](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@diegojerez](https://forums.kodeco.com/u/diegojerez)\
**Post date:** [March 7, 2017, 6:20am UTC](https://forums.kodeco.com/t/nullreferenceexception-in-chapter-8/26951/1 "2017-03-07T06:20:47Z")

</div>

Hello there,

I have a problem in chapter 8, with a NullReferenceException in this line in the GameManager’s Update() method: `alienScript.GetDeathParticles().SetDeathFloor(deathFloor);`

I think the variable `public GameObject deathFloor` is not selected correctly in the Unity Editor. I upload a picture to show the process I have followed.

 ![](https://raywenderlich-com-v3-forums.s3.amazonaws.com/original/3X/5/f/5f347741ec920b465235ba290f9fd8c15bc3ef84.png)

Can you help me?  
Thanks!

---

<div class="post-metadata">

**Author:** ![vegetarianzombie](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/vegetarianzombie/32/94022_2.png) [@vegetarianzombie](https://forums.kodeco.com/u/vegetarianzombie)\
**Post date:** [March 8, 2017, 8:18pm UTC](https://forums.kodeco.com/t/nullreferenceexception-in-chapter-8/26951/2 "2017-03-08T20:18:21Z")

</div>

Hey There … Sorry to hear you are having issues. Looks like something hasn’t been set or maybe a typo. A good way to debug this is to break that line into two separate lines.

So try setting the line to be:

var deathParticles = alienScript.GetDeathParticles();  
deathParticles.SetDeathFloor(deathFloor);

Then try the game again. That should tell you where the null pointer is coming from, and from there, we can determine the cause of the issue.

Thanks!

---

<div class="post-metadata">

**Author:** ![smeep2099](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@smeep2099](https://forums.kodeco.com/u/smeep2099)\
**Post date:** [December 16, 2017, 11:03pm UTC](https://forums.kodeco.com/t/nullreferenceexception-in-chapter-8/26951/3 "2017-12-16T23:03:28Z")

</div>

I had the exact same issue. What I found was that I missed this:

“In the Project view, expand the Alien prefab and select the AlienDeathParticles GameObject. Click Add Component and under scripts, choose DeathParticles.”

I could have sworn I did that step, but maybe I did it to the alien in the scene prior to deleting him, and I forgot to apply it to the prefab.

---

<div class="post-metadata">

**Author:** ![simpsond](https://s3.amazonaws.com/cdn.raywenderlich.com/community/forum-assets/noun-game-ghost-878668.png) [@simpsond](https://forums.kodeco.com/u/simpsond)\
**Post date:** [December 29, 2017, 7:45pm UTC](https://forums.kodeco.com/t/nullreferenceexception-in-chapter-8/26951/4 "2017-12-29T19:45:24Z")

</div>

I had the exact same problem. Thank you!
