DropItemAction for different items

dancinggoat23

New member
Hello. Maybe I'm missing something, but I haven't found a way to setup the DropItemAction in an Item Action Set so that the Pick Up Item prefab can be specified for different items. When I drop, say, a potion, I want to drop the specific item prefab for that potion. Likewise, when I drop a potion ingredient, I want that as the prefab. How do I set this up? Currently, it appears that the DropItemAction must go into the Item Action Set for an item category. Can I instead associate a DropItemAction with an individual item definition?

thanks!
 
The way we set it up is by having a single pickup prefab for all items.
The way we visually change how the item looks like when the item is dropped is by using the ItemObjectView component (in the next version it will be renamed ItemObjectVisualizer).
This component will listen to the event of the Item changing on the ItemObject when the pickup is instantiated and initialized. When the event is triggered we search for the item specific prefab in the Item itself through Attributes. This is a simple "GameObject" attribute that we usually call "Prefab" or "DropPrefab" you can set the attribute name in the inspector of the ItemObjectVisualizer.

Note that this is just our solution such that that we can use the same pickup prefab for any item and just change how it looks visually. It also allows you to use that item specific visual prefab for other things, like previewing the item in the UI for example (we don't do this, but it could be done).
If you do not like this solution you can create your own Item Action for dropping items. And instead of using a single pickup prefab, you could directly search for the item specific pickup prefab attribute on the item.

I hope that makes sense
 
The way we set it up is by having a single pickup prefab for all items.
The way we visually change how the item looks like when the item is dropped is by using the ItemObjectView component (in the next version it will be renamed ItemObjectVisualizer).
This component will listen to the event of the Item changing on the ItemObject when the pickup is instantiated and initialized. When the event is triggered we search for the item specific prefab in the Item itself through Attributes. This is a simple "GameObject" attribute that we usually call "Prefab" or "DropPrefab" you can set the attribute name in the inspector of the ItemObjectVisualizer.

Note that this is just our solution such that that we can use the same pickup prefab for any item and just change how it looks visually. It also allows you to use that item specific visual prefab for other things, like previewing the item in the UI for example (we don't do this, but it could be done).
If you do not like this solution you can create your own Item Action for dropping items. And instead of using a single pickup prefab, you could directly search for the item specific pickup prefab attribute on the item.

I hope that makes sense
Yes, it does, and it’s a brilliant solution. I’ll go with the default visualizer; that will work as-is for me. Thanks!
 
Top