- Home /
Error line 22! Help. i dont know why?
function Start () {
// Select the first weapon
SelectWeapon(0);
}
function Update () {
// Did the user press fire?
if (Input.GetButton ("Fire1"))
BroadcastMessage("Fire");
if (Input.GetKeyDown("1")) {
SelectWeapon(0);
}
else if (Input.GetKeyDown("2")) {
SelectWeapon(1);
}
else if (Input.GetKeyDown("3")) {
if (gameObject("AssultRifle").SetActiveRecursively(true));{
SelectWeapon(2);
}
else if (gameObject("AssultRifle").SetActiveRecursively(false));{
SelectWeapon(null);
}
}
Comment
fafase does a good answer I think you can switch it to answer :D
Best Answer
Answer by fafase · Oct 27, 2012 at 10:53 AM
you have a ; after an if-statement (actually after both but unity stopped on the first one).Remove them both, that should fix it.