- Home /
The question is answered, right answer was accepted
Shuriken Particles - how to start and stop emision?
Simply put: how do I show and hide particles.. or start and stop them?
Normally, I'd just enable/disable the mesh renderer, but I can't seem to drag a script on the Shuriken Particles object. What should I do?
well its simple...first u have to tell me if ur using the :mesh particle emitter"...and how do u want to stop it...."trough a button??...or like if u call it trough scipt?
It's just a plain Shuriken Particles emitter. I guess.. I just want to hide the mesh renderer. I don't really need any help with hooking it to buttons.. it's just I'm annoyed that I can't drag a script on the object. Do I need to access it from a separate object?
Answer by darkcookie · Jul 06, 2012 at 09:13 PM
using UnityEngine;
using System.Collections;
public class shuriken : MonoBehaviour {
//if u rename the script u have 2 rename "shuriken" too or else ull get errors
//dragg the script here ..
public MeshRenderer MeshRendererScript;
//if u press E u toggle the shuriken on and off..just so u get the idea..that it works
void LateUpdate(){
if(Input.GetKeyDown(KeyCode.E)){
MeshRendererScript.enabled=!MeshRendererScript.enabled;
}
}
}
all u do is attach it 2 the shuriken and dragg the emiter into the space..and then press E to toggle it on and off...
ok i fixed it srry had a little type error ;)...now it should toggle
$$anonymous$$y apologies. I would have easily figured this out, but the problem was just awkward positioning of the editor GUI for the shuriken component. Whenever I dragged the script in, it wouldn't accept it. The spot you drag the script to turned out to be really small, so, eventually I found it. Sorry for the trouble.
Follow this Question
Related Questions
Shuriken Particle Collisions - Collider shape? 0 Answers
Get all particles within trigger collider? 1 Answer
how to turn on and off particles with key press 0 Answers
My Particles Stop ? 1 Answer
How do I Update the transform of Instantiate prefab? 2 Answers