Question by
clement09 · Aug 13, 2017 at 01:53 PM ·
particlesystemchildrenonceemit
Emit once a group of Particle System
Hi, My problem is this one : (I already tried to find a solution since 2 days on many forum but without success)
I have a particle system with children wich are particles to.
My goal is to emit all of them only once, everytime a bool is true.
Here is my code :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ParticleLauncher : MonoBehaviour {
public ParticleSystem particleLauncher;
[SerializeField]
public ParticleSystem particleLauncher1;
[SerializeField]
public ParticleSystem particleLauncher2;
[SerializeField]
public ParticleSystem particleLauncher3;
[SerializeField]
public ParticleSystem particleLauncher4;
[SerializeField]
public ParticleSystem particleLauncher5;
[SerializeField]
public ParticleSystem particleLauncher6;
/ I put 1 particle Launcher for each particle I want to emit (children + parent), i know is absolutly not optimise/
public GameObject camera;
void Start () {
}
void Update () {
Debug.Log (camera.GetComponent<cameraScript>().checkbutton);
/* checkbutton is a bool in an other script of my game with return true or false (it works well)*/
if (camera.GetComponent<cameraScript>().checkbutton == true) {
particleLauncher.Emit(1);
particleLauncher1.Emit(1);
particleLauncher2.Emit(1);
particleLauncher3.Emit(1);
particleLauncher4.Emit(1);
particleLauncher5.Emit(1);
particleLauncher6.Emit(1);
}
}
}
Many thanks in advance for your assistance =)
hierarchy.png
(30.1 kB)
inspector.png
(67.3 kB)
Comment
Your answer
Follow this Question
Related Questions
Can I simulate particle system in edit mode without clicking on hierarchy? 1 Answer
How can I know when particle make new material 0 Answers
Sub Emitter spawning too high 0 Answers
Particle system how to emit continuous fog? 0 Answers
Particle System - Project Objects not appearing in 'Select Mesh' pop-up window! 0 Answers