sarbian/SmokeScreen — pull request #14 by toadicus (2014-07-10 21:50:09+00:00)
Title: Catch Exceptions tossed by GameObject.transform...

after parts have been removed by Unity.

The problem isn't in your code, it's in Unity. Whatever's hidden behind Unity's wrapper in GameObject's transform getter is throwing the NRE; without knowing how that method is implemented it'd be a tall order to find an appropriate null gate to avoid the error.

This commit adds exception handling to the go.transform call and just skips it if there's a problem. It might actually be more correct to destroy the GameObject, or remove the emitter from the List, or something like that; you'd know better than me. :)