- Home /
Weapon Pickup and Drop
I want to make system where if you press E facing a weapon it will pick it up (moving it under GunPosition in my player container) and then press E again to drop the weapon (removing it from GunPosition) I tried many scripts I found but they didn't work with what i'm trying to do i'm using unity3d 2020 beta and C#. Edit: I'm not using character controller i'm using RigidBodies for my player
You are pretty much asking for a tailor made solution for your specific game. None of the things you mention are hard to do, what you need ins$$anonymous$$d of "finding scripts" is to check and read all the Unity basics tutorials. Then you know what you need... Object in front of camera detection can can be simply done using a raycast from screen center, then get your component from target object. If it exists, you can then process it (= store it to your inventory). Input can be read using Unity's Input system GetKeyDown, see manual for details.