GameObject – Ways to reference and UnityEvents


//find gameobject by its name:
GameObject BigExplosion = GameObject.Find("BigExplosion");
//play the particlesystem component of the game object:
            BigExplosion.GetComponent<ParticleSystem>().Play();
            GameObject EnergyExplosion = GameObject.Find("EnergyExplosion");
            EnergyExplosion.GetComponent<ParticleSystem>().Play();
            //GameObject.Find("EnergyExplosion").active = true;
            GameObject.Find("Helicopter").active = false;

//adding UnityEvents:
using UnityEngine.Events;

public UnityEvent OnEnter, OnExit;

OnEnter.Invoke();