Ehi there!
There is an issue i’m struggling to resolve concerning the animator mechanics, i’m not sure if it’s a bug or i really did a huge mistake in programming, even though the script i’m having problems with is extremely simple.
First of all i have got a prefab with a 4 states animation layer.
They work like this:
As you can see there’s 4 states 2 for when the door is in motion and 2 for the idling animation(open/close idle).
The script managing the transitions is this one:
if (animate) {
if (!on) {
interactable.transform.GetComponent<Animator> ().SetBool ("up", true);
interactable.transform.GetComponent<Animator> ().SetBool ("idle", false);
StartCoroutine (AnimTime ());
on = true;
} else {
interactable.transform.GetComponent<Animator> ().SetBool ("idle", false);
interactable.transform.GetComponent<Animator> ().SetBool ("up", false);
StartCoroutine (AnimTime ());
on = false;
}
}
IEnumerator AnimTime(){
yield return new WaitForSeconds (animtime);
interactable.transform.GetComponent<Animator> ().SetBool ("idle", true);
StopCoroutine (Tempo ());
}
Once again it’s notable that the script is extremely simple and should work (but then again it’s not so i’m just assuming)
Given all of this.
When running, the variables in the script are changing and i can keep track of the script visually, confirming that it’s working.
On the animator side the thing is not working.
Once the first animation as been performed and is idling (the door has been opened and has stopped moving the animations die). The script is still performing actions but when i click to close the door the variables in the animator start to flicker, show incorrect values (even though the script is sending the right ones) and the whole thing become a mess.
Before the latest update the script was working oddly anyway (meaning some doors were perfectly working while others didn’t work at all or work when they felt to) but i wonder if the update could have f****d it up even more.
Any suggestion is welcome and needed.