Weapon pick up and switching script

Can someone tell me how to make a weapon pickup script, to pick up weapons randomly on the map and later be able to switch them. I want to have a maximum of two guns you can switch(like in COD) and then resultly pick a new weapon up and replace with your gun you are holding. The thing is I have tried some many times to do this but I never came to a result. I would prefer C# since I am more familiar with it.

Thanks in advance

For picking up a weapon simply think like this:

  1. if someone touches this weapon
  2. ask the player if he wants to pick it up (GUI)
  3. if they say yes
  4. move the weapon to the player hand

For switching between them try thinking like this:

  1. when the player [link text][1] to switch weapons
  2. instantiate the respective primary or secondary weapon to the player.

No one is going to give you code like that, but what I said is how you should think about doing it.

I hope this helps, good luck!

[1]: http://unity3d.com/support/documentation/ScriptReference/Input.html 4. "pushes a certain button"

As far as changing weapons, look at this: http://answers.unity3d.com/questions/53579/turning-the-mesh-renderer-back-on-problem/53723#53723