how to make spears that can be melee and also thrown?

Reza

Member
like the title, what should I do? for now my spear applies in melee, the simplicity is like a survival game in general that can throw a spear and can also take it back
 
I would try having two separate items, one MeleeWeapon and one ThrowableItem, and have them share ammo. For picking up the item again, you should be able to just have the ThrowableItem's thrown object be an ItemPickup prefab.
 
I could see this being done easily by call your own script to disable melee game object and enabling your throwable version during throw action. They should have the same position and graphic. Just leaving throwable version disabled to start.

Once you pick it back up you can call enable on the melee weapon again and remove the game object from scene.

If you are using the inventory system it will be a little more work
 
Top