Closed toadicus closed 10 years ago
Full disclosure: I didn't test this; I just tossed some code together at work and made sure it compiled. Based on my read of the logs I'm pretty sure this should work around the problem.
Let's merge it and we'll see :)
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. :)