I’ve been looking around trying to find a tutorial that utilizes C# for a script that allows me to pick up items with collision. Possibly a button press such as “e” or similar.
I know how to set up the colliders on the objects and such, I just don’t know where to begin with the scripting part where I can walk over the item and have it disappear and enable an item I already have disabled in the background for use.
For anyone in 2020 trying to implement this into their game this works.
I didn’t have to add any reference to the player controller only the input button.
This was attached to my object for pickup.
void OnTriggerStay(Collider other) // If ammo object collides with any collider…
{
if ((other.gameObject.tag == "Player") && (Input.GetButton("Pickup")