Unreal Engine Inventory Blueprints : Drop Items

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi this is J&M again with the next part of the inventory tutorial for Unreal Engine 4 using C++ and blueprints in this part I want to show you how to implement the drop logic of items from the inventory to an action bar at the bottom of the screen which we are going to create with umg so here we go this is where we stopped the last time we can drag the item from the inventory but we don't have a drop destination and this destination could be an action bar which is a fast access for items and we will implement this right now it is quite similar to the inventory it is also a UI widget and it contains these inventory items what we also have here is an item drag drop operation this is derived from drag drop operation it's also a blueprint and what I want to add here is a pickup actor okay I want to add it as a variable to this item drag drop so that we can access the pickup during the drop operation so let's added as a variable to this item drag drop operation type I call this pickup and the type will be a pickup actor I set this to exposable on spawn so that we can see it in our blueprint here in the in ventory item and here it is the pickup it's a pickup actor and what I want to do now is I want to set the pickup actor of the of the drag item to this item track drop operation pickup because we need this later on when we drop the item onto the destination but will come to this in a moment what I want to do now is to create this destination the action bar and as I said this is also a widget blueprint so I add it and call this action bar then open this and remove this canvas panel we don't need it what we need is a size box like we have it for the inventory and into this size box we're going to add a crit panel okay then I override the width and the height I set the width to 500 and let's try 150 for the height and set the view to the desired on screen so that we can see how this will look like when the game is started and then I drag a crit panel into this size box okay and this grid panel will contain inventory items and I'm going to add five I will speed this up because it's always the same process add the item rename it and move it to the next column okay great now we have an action bar with five inventory items and what's next let's adjust the height a little bit okay like so then compile and then I will add this action bar to our heart where's the heart here it is your eye H and then I find my action bar and drag it here into this canvas okay here it is then I will anchor this to the bottom okay this looks fine and now we can test the UI when we start the game okay this looks nice but now let's come to the drop operation because we can't drop we need to know which item is dropped onto this action bar so how can we do this well it's actually quite simple open the action bar then switch to the graph and here we are going to overwrite a function which is called on drop okay where it is here is onrop great and this is called when an item an inventory item is dropped onto this action bar so to test this we could for example print out a string just to see that this drop operation works and the string are set to drop operation executed or something like that okay and then save and compile and start the game to test it now collect this golden coin then it appears in the inventory and I drag it onto the action bar and yeah you can see in the upper left hand corner the drop operation appears so the drop operation works great now as the last step in this tutorial I want to find out which item is actually dropped onto this action bar and for this I can use the operation parameter of the on drop function I can cast this into an item drag drop operation you remember this is our derivation of the drag drop operation blueprint and it has a pickup actor assigned we assign this in the blueprint and this has a name and we print out the name to see which item is dropped onto the action bar all right now connect all the pins correctly and then we can again save compile and test okay I collected this draw it and here's printed out gold coin great I think I have somewhere a silver coin yeah here it is I collect this now drag the silver coin and silver coin is printed out great the logic for our drop operation works so we stop here and in the next part we will combine C++ and blueprint Logic for actually adding those items from the inventory to the action bar thanks a lot guys for watching my videos and don't forget to subscribe to my channel to not miss a future tutorial see you soon on J&M
Info
Channel: Jayanam
Views: 10,474
Rating: undefined out of 5
Keywords: unreal engine drag drop, unreal engine 4 drag, unreal engine 4 drop, unreal engine blueprints c++, ue4 c++ bluerints, unreal engine drag drop tutorial, ue4 drag drop tutorial, how to drag drop with ue4, how to drag with unreal engine, umg ue4 tutorial, unreal engine umg, unreal engine 4 umg, unreal engine 4 inventory system, unreal engine inventory system, unreal engine 4 drag and drop
Id: 2s8X3lcMz9U
Channel Id: undefined
Length: 7min 11sec (431 seconds)
Published: Mon Jun 12 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.