I am having issues with correcting this script and I just can’t figure it out…
Please help
The error I get in Unity is…
"
Assets/Scripts/Player Scripts/Weapons.js(11,35): BCE0022: Cannot convert ‘UnityEngine.GameObject’ to ‘int’.
"
#pragma strict
var weapons: GameObject[];
private var curWeapon: GameObject;
function ChangeWeapon(weapon:int){
if (curWeapon){
Destroy(curWeapon);
}
curWeapon = Instantiate(weapons[curWeapon],transform.position,transform.rotation);
}
function Update(){
if (Input.GetKeyDown("1")) ChangeWeapon(0);
if (Input.GetKeyDown("2")) ChangeWeapon(1);
if (Input.GetKeyDown("3")) ChangeWeapon(2);
}