picking up and using animated items/weapons.

hello everbody, i am making a zombie survival game but with only melee attacks with stuff you find lying around in the environment. what i want is as follows:

  1. so when i walk upto an object a tag comes up saying press E to pick me up

  2. when i click E over the object it gets put into my hands

  3. the walk/ run/jump animations now work with object e.g. picks up chair, animation is changed to make him walk with chair. etc.

  4. custom attack with object thats now available. e.g. picked up a drill and plays animation of drilling through zombies head when attacking.

i was thinking of having all the weapons constantly on my char. and make them visible when is told to be equipped. but in testing stages for this action i struggled to turn off just the weapon i was then thinking of setting up a bool for each weapon so it actives the right animations in my animator.

im not quite sure that this is the best way and if it is i still need some guidance as i cant seem to get it to work at all as i want it to.

any possible methods, relevent youtube tutorial links or coding examples would be great.

im using blender for my models and animations if that makes any difference and im coding in c sharp.

thanks.

really depends how you are doing your inventory/item management system, but as a “general pointer”:

you want to split up the ideas of “items in inventory” and “items being rendered”

an item can be an object that doesn’t inherit from monobehaviour that just holds all the variables needed, it’s not going to be doing anything whilst it’s just sat in the inventory not being used. That object can have a reference to the prefab you want to instantiate when you want to equip it. If the char can only have one thing per hand you can have a script which stores the “current item” and handles the destroy/instantiate of the prefab variable when you change weapons.