Apparently it’s not about the manager. Just none of the Input commands (Input.GetKey / GetButton) seems to work AT ALL for me. Here’s an example “change weapon” script. If someone more experienced could toss an eye and check what’s wrong?
private var WMeleeOn : boolean; private var WLongOn : boolean;
var WeaponMelee : GameObject; var WeaponLong : GameObject;
function Update () {
if (Input.GetButtonDown ("ChooseMelee"));
{
if (WMeleeOn == false)
WeaponMelee.active = true; //Shows Knife
WeaponLong.active = false; //Hides Rifle
}
}
But i think the problem is that you need format the code correctly.
when you use an IF statement you do not need to add ; at the end, instead you need to encapsulate it. for instance…
private var WMeleeOn : boolean; private var WLongOn : boolean;
var WeaponMelee : GameObject; var WeaponLong : GameObject;
function Update()
{
if (Input.GetButtonDown ("ChooseMelee"))
{
//code placed here will run when the first if statement condition is met
if (WMeleeOn == false)
{
WeaponMelee.active = true; //Shows Knife
WeaponLong.active = false; //Hides Rifle
//code place here will run when both if statement conditions are met
}
//code placed here will run when the first if statement condition is met
}
//code placed here will run on Update
}
just remember to use { and } in the correct places.