Search Unity

null refrence

Discussion in 'Scripting' started by Benopaluz, Jun 22, 2011.

  1. Benopaluz

    Benopaluz

    Joined:
    Aug 14, 2010
    Posts:
    300
    Im trying to emit a particle when a function is called, which it does, except once the particle has been emitted and i next call that function it causes a null?
    i cant really figure it out.


    ParticleEmitter hitParticles = GameObject.Find("blood").GetComponent(typeof(ParticleEmitter)) as ParticleEmitter;
     
  2. JFFM

    JFFM

    Joined:
    Nov 13, 2010
    Posts:
    336
    Is your Particle Emitter set to Autodestruct?

    -JFFM