Void start from current script not disable other script
Good morning everybody, I have a strange trouble in my script, in "Void Start" i need disable other script in the same gameobject until that player pass enter in collider trigger, and the script will disable when exit. This second script only should enable when player pass in collider trigger.
But all that I have made don't work, when I play the project the script turn ON and change variables before of the colision in trigger. I think that collider OnTrigger don't accept this feature.
When the player pass in collider, the script keep working and when exit from collider, the script turn OFF. The problem looks in the void Start.
I allready have try others things like gameObject.GetComponent().isTrigger = false, but of I disable the trigger this don't will work.
If someone could help me thanks a lot :D
My script:
using UnityEngine; using System.Collections;
public class FuelOnCollider : MonoBehaviour {
private scriptCarRefuel CurrentPump;
public Light Light1;
public Light Light2;
void Start ()
{
CurrentPump = GetComponent<scriptCarRefuel>();
CurrentPump.enabled = false;
Light1.enabled = false;
Light2.enabled = false;
}
void OnTriggerEnter(Collider other){
CurrentPump.enabled = true;
Light1.enabled = true;
Light2.enabled = true;
}
void OnTriggerExit(Collider other){
CurrentPump.enabled = false;
Light1.enabled = false;
Light2.enabled = false;
}
}