First here’s the code: `using UnityEngine;
using System.Collections;
public class AnimationTest : MonoBehaviour {
public GameObject leganim;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetMouseButtonDown(0)){
GetComponent<MegaModifyObject>().enabled = true;
}
else{ if (leganim.GetComponent<MegaPointCache>().time >= 2) {
GetComponent<MegaModifyObject>().enabled = false;
}
}
if ( Input.GetMouseButtonDown(0) && leganim.GetComponent<MegaPointCache>().time >= 2 ){
GetComponent<MegaModifyObject>().enabled = true;
}
if (leganim.GetComponent<MegaPointCache>().time >= 5) {
GetComponent<MegaModifyObject>().enabled = false;
}
if ( Input.GetMouseButtonDown(0)){
GetComponent<MegaModifyObject>().enabled = true;
}
if (leganim.GetComponent<MegaPointCache>().time >= 8) {
GetComponent<MegaModifyObject>().enabled = false;
}
//else{
//GetComponent<MegaModifyObject>().enabled = false;
//}
/*if (leganim.GetComponent<MegaPointCache>().time >= 10) {
GetComponent<MegaModifyObject>().enabled = false;
}*/
}
}
`
Basically what is happening is I have three different scripts attached to a single object. With this AnimationTest script I am referencing the variable “time” in the MegaPointCache script and when that time is greater or equal to 2 seconds turn off the MegaModifyObject script. The MMO script starts out off; when I click anywhere it turns on and the MPC script proceeds to over 2 seconds (the developer has it increasing randomly to 6 decimal points; hence the greater than part) the MMO turns off. But when I try clicking to turn it back on and proceed to 5 seconds, it won’t turn on and I can’t even turn it on manually. I’m assuming this is due to the commands conflicting and since it is still over 2 seconds it won’t let it turn on even though I’m telling it to. I don’t know how to fix this, but I’m guessing it’s pretty simple (hopefully).
Any ideas on how to fix this? Thanks!