using UnityEngine; using System.Collections; public class SpawnTrigger : MonoBehaviour { #region PUBLIC VARIABLES public GameObject[] gameObjects; // Array of GameObjects that will be set active public bool isTriggered = false; // Determines whether or not the trigger has been activated #endregion #region COLLIDER 2D COMPONENT METHODS [OnEnter] /// /// Iterates through the array of GameObjects and sets them to an active state when the trigger is entered /// /// The Collider2D that is entering the trigger void OnTriggerEnter2D(Collider2D collider) { if(collider.tag == "Player" && this.isTriggered == false) { this.isTriggered = true; foreach(GameObject gameObject in gameObjects) { gameObject.SetActive(true); } } } #endregion }