Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class SetActiveOnTriggerEnter : MonoBehaviour {
- //public string FindGameOBJ; <-To be implemented for future re-usability. Ignore it for now.
- // public string ComponentToActivate; <-To be implemented for future re-usability. Ignore it for now.
- void OnTriggerEnter (Collider coll) // Collision detection.
- {
- if (coll.tag == "Ball") //Checks the tag to see if it is the PARENT OBJECT.
- {
- if (GameObject.Find("BallHealZone") == null) //Looks for the CHILD OBJECT, and if it is null than move forward.
- {
- Debug.Log("Activating BallHealZone! :)"); //Tells me if it found said object, and confirms it is indeed null (yes it works).
- gameObject.SetActive(true); //Activates the CHILD OF PARENT OBJECT.
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment