- Home /
Instantiating Particle System and Editing Base Settings
I've been attempting to Instantiate a particle system using an empty Game Object in front of the player model, however I get errors such as:
"MissingComponentException: There is no 'ParticleEmitter' attached to the "Main Camera" game object, but a script is trying to access it."
As far as I know i'm not accessing anything that should be parented to the main camera, i'm using GameObject.Find() to search for it. I should mention that i've also tried GameObject.FindWithTag() to search for it.
 function Air_Push(power : int, duration : float){
 
 if(!power){
 
     Debug.Log("[Air Push] Power Not Set");
     
 } else if(!duration){
 
     Debug.Log("[Air Push] Duration Not Set");
     
 } else{
     
     GameObject.Find("Air Particles").particleEmitter.maxEnergy = duration;
     GameObject.Find("Air Particles").particleEmitter.minEnergy = (particleEmitter.maxEnergy - 0.5);
     GameObject.Find("Air Particles").particleEmitter.localVelocity.z = power;
     GameObject.Find("Air Particles").particleEmitter.emit = true;
     
     yield WaitForSeconds(duration);
     
     GameObject.Find("Air Particles").particleEmitter.emit = false;
     Destroy(GameObject.Find("Air Particles"));
     
 }
 }
I wish to keep the ParticleSystem as a prefab for future purposes as i'll be giving players only a few of the available weapons/spells, so I won't parent it to the player unless absolutely necessary, I don't want a lone particle system hanging around on a player who hasn't selected to use it from the weapon selection menu.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                