Unity 3D script help!?

i’m making an rpg , and you can go to a locker and search it and it will automaticly place it into the weapons you’re holding here’s the script to swap my weapons

#pragma strict

var Weapon01 : GameObject;
var Weapon02 : GameObject;

function Update () {

if(Input.GetKeyDown(KeyCode.Q)){

SwapWeapons();

}

}
function SwapWeapons()
{

if(Weapon01.active == true){

Weapon01.SetActiveRecursively(false);
Weapon02.SetActiveRecursively(true);

}else{

Weapon01.SetActiveRecursively(true);
Weapon02.SetActiveRecursively(false);

}

if(Input.GetKeyDown(KeyCode.B)){

gameObject.tag == “m4a1” == Weapon01;

}

}
i want to some how place it as a game object so it would be the third one or second dosent matter
i was thinking have the gun as a boolean and if its true place it as the gameobject, but how thanks!

✅ Answers

? Best Answer

  • Making RPG in Unity 3D: http://answers.unity3d.com/questions/365…
  • Leave a Comment