Dropped weapon bug

I created a Pickup_shotgun. It works fine. I made another weapon (shotgunclub) the AI to use (using the sword animations).
In the shotgunclub, the Drop Prefab is Dropped_shotgun, which has the same values as the Pickup_shotgun. Now, when the AI dies, it drops the Dropped_shotgun but the player can't pick it up. It displays the Pickup Message Text and plays the audio but the player doesn't get the weapon or the ammo.

When the AI dies, I get an error message:
transform.position assign attempt for 'Dropped_shotgun(Clone)' is not valid. Input position is { NaN, NaN, NaN }. UnityEngine.Transform:set_position (UnityEngine.Vector3)

I know the Dropped weapon works, because I can place it in the scene and pick it up that way.
 
You can't drop an item with a different item definition. The drop prefab is only used as a visible object, but the item definition for the pickup is set to the one of the dropped item (in your case the shotgunclub). This can't be picked up by the player (as he only knows the shotgun). You can add both, a shootable weapon, and a melee weapon to an idem for dual use. So, you don't need two weapons for this. Check the assault rifle from the demo for example.
Can you post the full error message? I don't know why the position is set to NaN.
 
I don't understand. The Dropped item (that I made with the Object Manager) contains the Item Pickup script. I can pick up the Dropped item if I put in in the scene before the game starts, but I can't pick it up if the item is actually dropped by an AI from a different weapon. because the definitions are different? What if I wanted the AI to drop a healthkit or ammo?
 
When you drop an item by a UCC character, the inventory will replace the item definition of the pickup with the one of the weapon that the character holds.
The inventory coming with UCC is limited, as the focus is on the character controller, and its abilities. If you need enhanced inventory functionality, I recommend taking a look at the Ultimate Inventory System. It comes with enhanced options to drop items (like random items, etc.).
 
Top