Dropping items to instantiate associated prefab

scroogi

New member
Hello again!

I am having another problem that I am hoping you can help me with. I feel like I must be doing something silly, but I can't figure out what the problem is.

I am trying to drop items from my inventory, and have them spawn the item prefab next to my character. The prefab has the Item Pickup Component and is linked to the item definitions as "PickupPrefab". However, when I try to drop the item with the "Drop" action, it tells me "Item Pickup Prefab is Null on the Drop Item Action". I see that there is a slot for a prefab, but I don't want to drop the same prefab for every item.

Do I need to make a separate drop action for each item? Or is there a way to tell it to instantiate the prefab associated with the item definition?

Thank you for your help again!!

EDIT:
Okay, wait. I think I might see what you're doing here. I set up a default drop prefab, and the added the visualizer to help it find the right prefab. It drops the right objects now!

Do I need to change these fields to make sure that the dropped items spawn properly?

Screen Shot 2021-06-21 at 4.21.32 PM.png


EDIT AGAIN:

I see they are all spawning as drop default clones with the correct components. This seems right! Lol so glad I figured it out. I'll leave this here though if anyone else needs the help.
 
Last edited:
Yes that's exactly it.
The ItemPickup is just a trigger with a reference to an item.
The way the item looks like is defined by the Visualizer.
Some items might not have a visualizing prefab, so you can set a default one.
The Item View helps show the item name before picking up the item.

The reason I designed it this way is because creating an item picked prefab for ever single item was irritating when I was using UCC a long time ago. I like this approachsince the visual item prefab part can be reused for other things and not just pickups.

I'm glad you were able to find the solution on your own :)
 
Top