Use the Pickup Item script to pick up ammo/health kits and weapons. This script has 2 pickup methods: "Raycast", "Collider" or both.
To create a pickup object, place it into your scene and add the Pickup Item script.
When a character enters the area, he picks up an object.
When the player is in the area and the crosshair is pointed at an object, click on the [E] button to pick it up (you can edit the button in the Input Manager (Tools -> USK -> Project Settings -> Input).
You can create ammunition that is only suitable for a certain type of weapon.
- In the Ammo Name variable, write the ammunition name
- In the Weapon Controller script, write the same name
If you leave an empty name, the ammo can be used for any weapon.
If you pick up ammunition, and there is no suitable weapon in the inventory, it will be saved and hidden; And when you get the required weapon, the ammunition will be displayed.