condition on multiple item drops

Syed Suhaib Zubair 2 months ago in Inventory updated by Marti (Lead Developer) 2 months ago 5

I am confused on how to use the trigger "On Drop item". I am confused because if i use the default system of inventory of drag and drop item out of inventory it works. it simple instantiate the prefab of an item. is there can be a condition under a trigger that if item dropped then do this. i want to do something if item dropped then do an action.

For example. 

i want to drop a gun which have 15 bullets also with it and i am holding that gun in my hand.

Now if i drop the item from inventory by dragging then player holster the weapon and subtract the bullets from the ammos i have. 

Hope you can understand what i am trying to say.

Here i am confused on using the trigger.

Is there any a good guideline on how to use this trigger.


Unity version:
Game Creator version:

If you want to execute a set of actions when dropping an item, simply add a "On Start" Trigger on the prefab being instantiated when dropped.

its working but there is an issue. if  i use "On Start" trigger it starting performing action on Game Start. i want only when item is dropped. and please guide me more little bit. when the prefab of the dropped item instantiated as a clone i want it to be the child of an another blank gameobject. what should i use when item dropped.? This is part of my Above asked question not a separate. i need that action when item dropped.

You can use the Transform action to parent the instantiated object as a child of another one.

I have already tried the Transform action. But unfortunately when the item dropped the clone show none gameobject in Transform Action. If you see in the picture given below. i have highlighted "WeaponContainer" GameObject.

When i dropped the Gun it instantiated and i use the Transform action as you said. here you can see the new parent is now "none" when Gun prefab instantiated. Why it happening? 

Please clarify me the reason and a give a good solution.

Probably because you're trying to reference an object that can't be serialized (like the instance of an object that is instantiated at runtime).

You can use a Local Variable as the parent and set the value at runtime using the "Assign Game Object" Action.