script position

hello was trying to develop a script when it is in phase -3 or below the Y axis, it is active a variable when it is above the -3 layer it deactivates that variable

here is the script I said:


using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

public class Test : MonoBehaviour {
public GameObject Homem;
void Start ()
{
if (Homem.transform.Translate( 0,-3, 0))
{
Homem.GetComponent().VaiNadar = true;
}
}
}

You could try having a separate script that always manages that.

If you disable the script that is checking the position, it won’t be able to enable itself. Try adding a second script that can be always on, to manage the first script.