switching gun on screen with gun you pick up.

Right now i have it so when you run into a gun laying on the ground it gets destroyed so it looks like you picked it up. How now do I have that gun replace the one currently being held on the screen. Thanks

It depends on how your gun works. You might be able to use GameObject.SetActiveRecursively(boolean), which activates or deactivates a GameObject and all of its children (SetActiveRecursively(false) turns it off, SetActiveRecursively(true) turns it on).

For instance you could have an array of weapons, and select a weapon by turning it on and turning all other weapons off. Here's an example where you pass in the index of the weapon you want to select, and it turns that weapon on and all others off.

var weapons : GameObject[];

function selectWeapon(var i : int){
    for(var j : int = 0; j <weapons.length; j++){
        if(j == i){
            weapons[j].SetActiveRecursively(true);
        } else {
            weapons[j].SetActiveRecursively(false);
        }
    }
}

**I just typed this up and haven't actually tested it so apologies for any syntax errors or typos

There's probably something here you can look at: http://www.dastardlybanana.com/FPSConstructorWeapons.htm

You should have a prefab of the weapons you pick up. Just use an instantiate api, and find out how to add the weapon to be a parent of the player. simple with unity