using UnityEngine; using System.Collections; public class SelecteArma : MonoBehaviour { public bool Equipamento = true; void Start () { } void Update () { if (Input.GetKeyDown ("1")) { selecionarArma (0); } if (Input.GetKeyDown ("2")) { selecionarArma (1); } } public void selecionarArma (int index){ for (var i = 0; i<transform.childCount; i++) { if (i == index) transform.GetChild (i).gameObject.SetActiveRecursively (false); else transform.GetChild (i).gameObject.SetActiveRecursively (true); } } }