Jump to content

inventoryitem events

Recommended Posts

Let's talk about events in inventoryitem component. There are 4 events: pickup, drop, activeitem and putininventory. When they are triggered?


  1. ​OnPutInInventory
  2.  OnDropped
  3. OnActiveItem
  4. OnPickup, OnPutInInventory (first Pickup, then PutInInventory)
  5. OnPickup, OnPutInInventory, OnActiveItem
  6. OnPickup, OnDropped, OnPutInInventory, OnActiveItem

So when?


  • When item is moved to container, inventory or backpack
  • When item is equipped
  • When item is moved to mouse cursor except moving directly from equipped slot


  • When item is dropped on the ground (obvious) 
  • When item is picked up from the ground in mouse cursor (if no free cell in inventory)


  • ​Only when item is moved to cursor


  • ​When item is moved to inventory (not backpack),  obvious 
  • When item is moved to cursor, except moving directly from equipped slot
  • When item is moved to container, except moving directly from cursor


Thank you for reading. :)


Link to comment
Share on other sites

Notice that any backpack is a container! So if you put item to backpack, OnPutInInventory occurs.

But OnPutInInventory function is taking backpack instance as parameter (not character instance).

And if character drops the backpack, there are no events for the item.

Link to comment
Share on other sites

OnPutInInventory is what OnPickup should be.


OnPickup is useless for items that can be equipped on pickup..

OnPutInInventory beats OnPickup on this.


OnDropped and OnPickup should destroy/change the item if they have positive effects because then it would be exploitable.

Like +5 sanity on pickup. Drop/pickup for free sanity. Flowers destroy themselves and give the player petals.


OnActiveItem is pretty much useless.

There is not a single prefab that uses SetOnActiveItemFn, or that changes activeitemfn.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...