0
Error in the array of Animation, please see in the video that you will understand, at the time of the change of an object to another it is totally erased.
public Animation[] Animation1;
private int Selecao8;
public void ProximaSelecao8()
{
//Animation1 [Selecao8].SetActive (false);
Animation1[Selecao8].GetComponent<Animation>().Play();
Animation1[Selecao8].GetComponent<Animation>().enabled = false;
Selecao8++;
if (Selecao8 > Animation1.Length - 1)
{
Selecao8 = 0;
}
//Animation1 [Selecao8].SetActive (true);
Animation1[Selecao8].GetComponent<Animation>().Play();
Animation1[Selecao8].GetComponent<Animation>().enabled = true;
}
public void AnteriorSelecao8()
{
//Animation1 [Selecao8].SetActive (false);
Animation1[Selecao8].GetComponent<Animation>().Play();
Animation1[Selecao8].GetComponent<Animation>().enabled = false;
Selecao8--;
if (Selecao8 < 0)
{
Selecao8 = Animation1.Length -1;
}
//Animation1 [Selecao8].SetActive (true);
Animation1[Selecao8].GetComponent<Animation>().Play();
Animation1[Selecao8].GetComponent<Animation>().enabled = true;
}
}
Hello, welcome to SOPT. I suggest you focus your doubt and make it more objective. The way it is, you can’t know exactly what your difficulty is. For example, in that code current attribute
Animation1
is commented and therefore does not exist. The code must be making a compilation error right there. Other than that, the methodPlay
must be invoked directly, for he is not an array. The array is the attributeAnimation1
, then you should have doneAnimation1[Selecao8].GetComponent<Animation>().Play();
most likely.– Luiz Vieira
I’m just trying to do an array of Animation. For example enable and disable, using the lenght -1.1 in onclicks only that I’m not getting if you can help me or fix what I’m missing would appreciate it very much.
– Fabio Rangel
I already helped you. Did you read what I wrote? I suggest you try the changes I suggested and if it doesn’t work, go back and edit the question to make your mistake clear. Don’t take this the wrong way, but this site is not a forum and neither is "classified" so you can find someone to do it for you. If you haven’t done yet do the [tour] and read [Ask].
– Luiz Vieira
kkkkkk ok ok... joking aside, I fixed the error that persisted. only it gave a problem, I will edit the question with the made and the error.
– Fabio Rangel