How can I make an effective weapon pickup system?

I’m making an FPS survival. I want my player to be able to find weapons and pick them up, but he can only hold two weapons max. How would I go in making it so when I pick up a weapon, I drop the current weapon in my hand if I have 2 weapons. Also I want the player to start with just a knife, and when he finds his first weapon, he can pick it up without dropping anything. How would I go in implementing this?

OK set a box collider trigger on the item to be picked up and use the OnTriggerEnter() event to do the pickup and drop needed. (See the docs for more details).

Also do a search for tutorials on this topic as there are a few, not sure but there will probably be something in the Learn tutorials (top bar) on this or parts of it.

Well as Arowx said your going to need a box collider set to trigger, But one thing that stumped me alot when i started with unity is you have to have a rigidbody attached to use the

function otherwise it wont register Then in that function. Do some code to add the item to your inventory, and destroy the pickup. as far as managing which items are held at the time, thats kind of up to you to figure out, depends on how you want to implement it.