0
Well, I’ll get to the point, could give me a force in this script I’m doing, it selects using buttons -1 and 1, until it works more the previous gets bugged
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ObjectSelection : MonoBehaviour {
public GameObject[] ObjetosSelecionado;
private int Selecao;
public void ProximaSelecao(){
ObjetosSelecionado [Selecao].SetActive (false);
if (Selecao >= ObjetosSelecionado.Length - 1) {
Selecao = 0;
ObjetosSelecionado [Selecao].SetActive (true);
} else {
Selecao++;
ObjetosSelecionado [Selecao].SetActive (true);
}
}
public void AnteriorSelecao(){
ObjetosSelecionado [Selecao].SetActive (true);
if (Selecao >= ObjetosSelecionado.Length -1) {
Selecao = 0;
ObjetosSelecionado [Selecao].SetActive (false);
} else {
Selecao++;
ObjetosSelecionado [Selecao].SetActive (false);
}
}
// Use this for initialization
void Start () {
for (int i = 0; i < ObjetosSelecionado.Length; i++) {
ObjetosSelecionado [i].SetActive (false);
Selecao = 0;
ObjetosSelecionado [0].SetActive (true);
}
}
}
if it’s easy for you, then you can give me a strength, in the next selection I get more the previous one is that stopped me
– Nitecki
Does the code I put in not work? @Nitecki
– Christian Beregula
now was the reverse, the previous works more the next n
– Nitecki
I think now go, had an equal left that did not let select the last position
– Christian Beregula
and I thought it was necessary a for, very obg by the help worked
– Nitecki