I am trying to activate my gameobject when my “player” y position is set to my PlayerHeight float. This code is not pulling an error but it simply does nothing when attached to the target object that I am trying to activate. this question is probobly really stupid but I am new enough to C# coding. Spare with me please. Here is my code:
using UnityEngine;
using System.Collections;
public class WaterFlip : MonoBehaviour {
public float PlayerHeight;
// Use this for initialization
void Start () {
}
void Update () {
if (GameObject.Find("FPSController").transform.position.y < PlayerHeight) {
gameObject.SetActive (true);
}
}
}
Thanks,
CaptainChaos