For a fire effect i added a particle system but how do i make it that they both turn on when i press my left mousebutton and disapear when i release it?
Or just disapear when i press again.
Evantualy i need both so i hope that you could help me.
problem no 1 : uncheck the LightOK in the script in the particle system and uncheck the ParticleSystemOK in the script in the light problem no 2 : don't uncheck the Particle Renderer , uncheck the Emit option in the particle emitter i think that was the problem
add it to any thing containing a light and a particles , if you want to add it to an objects that contains just a light or just a particles i will give you the code
problem fixed with function Update() { if (Input.GetKeyDown("mouse 0")) { if (light.enabled == true) { light.enabled = false; particleEmitter.emit = false; } else { light.enabled = true; particleEmitter.emit = true; } } } if you want to turn them off by default go to the light component and turn the chick box off , on the particle particleEmitter turn the emit chick box off
but then still when i attach it to the torch object it says there is no Light attached to it.
only if i put it on the light itself it works but not exactly how i would like it becouse it turns on when i click and off when i click again and i would like that if i release my mouse it turns off.
and the script wont do anything with my particles is that becouse i use a particle system?
becouse when i put the script on that to nothing still happens so did i do something wrong??
oh yeh im putting the story im working on of the game up on deviantart tomorrow i think.
i hope im not bothering since im realy bad at scripting myself and this is my first real game i try.
and if you’re wondering why i want the mouse button like that is becouse the torch is more of a fire staff.
i edited the script on this answer try it
– Subhiyou should add the script to the light object and the particle system object
– Subhiproblem no 1 : uncheck the LightOK in the script in the particle system and uncheck the ParticleSystemOK in the script in the light problem no 2 : don't uncheck the Particle Renderer , uncheck the Emit option in the particle emitter i think that was the problem
– Subhi