- Home /
 
I am trying to control a Particles System via scripting, it gives me the desired effect in the editor, but not so much on an Android device. Help!!
 #pragma strict
 var ninga1: GameObject;
 
 function Start () {
 
 }
 
 function Update () {
 
         if(Input.GetKeyDown(KeyCode.M)) {
             particleSystem.Play();
         }
     transform.position.x= ninja1.transform.position.x;
 
 }
 
 the above code works fine in the editor., but when I update my code to following,
 
 #pragma strict
 var ninja1: GameObject;
 
 function Start () {
 
 }
 
 function Update () {
 
     for(touch in Input.touches)
         if(touch.tapCount==3) {
             particleSystem.Play();
         }
     transform.position.x=ninja1.transform.position.x;
 
 }
 
               the particles emit for a couple of times, maybe a few more times (sometimes), then that's it. Any kind of assistance would be apprciated. By the way, I had attached the above script to a Particle System in the Hierarchy.
For future posts, please select your code after pasting it into the question and use the 101/010 button to format. I did it for you this time.
thank you @robertbu.,I will keep that on my $$anonymous$$d,.
Answer by Souvik · Jul 19, 2014 at 08:04 PM
Well.,I figured it out.,all i had to do was apend particleSystem.Simulate(0.0); to the code. Now, works wonderfully well. 
Answer by Xtro · Jul 18, 2014 at 08:45 PM
Why are you looping for touches ? Remove the for loop and just keep the if.
thank you @Xtro for ur comment, but the problem still persists.,by the way, i removed the for loop and updated the if to,
 if(Input.touchCount==2)
         particleSystem.Play();
 
                  Is this what you were talking abt??
okay.,my bad.,i see what i did there.,i added "Input.touchCount".,but it means if I touch the screen with two fingers simultaneously, the particle system should play, right? it does though, but only for a couple of times like before. Is there some setting in the "Particle System" that i could be missing?
Your answer
 
             Follow this Question
Related Questions
Gems shine effect (particle system ) reducing my performance. 2 Answers
Kindle Fire, Particle System 0 Answers
Particle System not working properly on Android 0 Answers
Particle System glitch on Android phone. 0 Answers
How do particle systems update? 1 Answer