How to play particles out of child

323 views Asked by At

Structure is Cube+Bridge>Cube>CubeTrigger where I want to attach script OnTriggerEnter (Collider other) and

I want to turn on 4 particles that are Cube+Bridge>Cube>ParticleGroup>Fire1, Fire2, Fire3, Fire4.

How to get to them?

2

There are 2 answers

0
Phantoms On
using UnityEngine;
using System.Collections;

public class CubeTrigger : MonoBehaviour {

    public ParticleSystem Flame1;
    public ParticleSystem Flame2;
    public ParticleSystem Flame3;
    public ParticleSystem Flame4;

    void OnTriggerEnter (Collider other) {

        Flame1.Play ();
        Flame2.Play ();
        Flame3.Play ();
        Flame4.Play ();
    }
}

That was quite easy task. I forgot that I can just drag and drop particle I wanna use :) thx

3
Sam Marion On

It's hard to tell what you are asking but if you want to play your particles based on OnTriggerEnter you could do it a few different ways.

I would either enable the particle system when OnTriggerEnter is called or instantiate the system at the location of the child.

You will probably want to make a reference in the script for the Particle system and enable or instantiate it that way.