Complete Skyrim like inventory Tutorial

I’m getting a lot of request to create Skyrim like inventory Tutorial. I have found you guys have a problems with ShooterTutorial inventory implementation as well. ShooterTutorial inventory is about choosing weapons before starting gameplay. That’s why I have decided to create complete Skyrim like inventory tutorial which will:

  • be object oriented,
  • starting from first person template,
  • have 3d preview in UMG,
  • support item dropping, using,
  • support categories,
  • support moving items,

This tutorial is long and not so easy. As always take your time!

Other helpful tutorials

There is couple of great tutorials over the internet which you can try before this.

Feature request for Epic

I have created couple of feature request for Epic so it will be simpler to create such inventory.

  • Viewport widget that’s creating new UWorld and we can place meshes there. It would be much more easier to draw 3d content in UMG, (as far I can know Epic is working on this)
  • On Mouse Enter / Leave events on Buttons,
  • Get Component Bounds issue fix,
  • Blueprintable XML parser,
  • Possibility to create new assets from blueprints, (the goal is to have XML which will create objects and then automatically create world actors from those actors that can be placed in level),
  • Update content browser thumbnail after construction script, (or add a possibility to capture thumbnail in current component mode seen in editor)

First Person Template

Open your 4.10 Editor and create new blank project from First Person Blueprint Template.

Architecture

Inventory - SiteMap

Let me drive you trough basic architecture.

Object Oriented

Items will be object oriented and will use Objects instead of Actors. Let’s create first base Object for items.

Base Item Object Class

Create new blueprint named Item extending from Object. Open it and add those variables:

Var Name Var Type Default Value  Description
ID Text Especial ID for the item. It is text to be able to better search later. There shouldn’t be two the same items with the same ID!
Name Text Name of the Item – it can be “Shield” or “Dagger” whatever you like. This will be showed in UI.
Value int Value of the item.
Weight float Weight of the item.
WorldMesh StaticMesh Reference Reference to the static mesh that will be graphics representation of the item. Thanks to that we will know which static mesh should be assigned later.

And that’s all for now. It will be base class for all of the items. It doesn’t have any damage, armor rating variables.

Armor Item Object Class

In Skyrim some types of items have dedicated variables such as damage, armor rating or special effects. To have the system more generic each new item category (armor, weapon, misc, ingredient etc)  will extend from Item class.

Create new Blueprint named Item_Armor extending from Item created earlier. Open it and add one new variable:

Var Name Var Type Default Value  Description
ArmorRating float This will be armor rating for armor type item.
USEFUL TIP: This is the place where you can add equip type, mount type to the object . I won’t do this because it’s not in the scope of this tutorial. I won’t be equipping items to hands or body.

Weapon Item Object Class

Create another Blueprint extending from item named Item_Weapon.

Var Name Var Type Default Value  Description
Damage float Damage for the weapon.

This is the place where you can add equip type, mount type to the object . I won’t do this because it’s not in the scope of this tutorial. I won’t be equipping items to hands or body.

Rest Items Object Classes

Now create rest of the item types classes. Create new Blueprint extending from Item:

  • Item_Book,
  • Item_Ingredient,
  • Item_Potion,
  • Item_Misc,

They do not have any custom variables.

If Item is Object how to add it to level?

Yes, Objects can’t be placed into world. They are just data blueprints which aren’t generating any draw calls.

That’s why I will create an Actor that will have reference to Item object.

Create new Blueprint extending from Actor named ItemWorldActor. Open it and those components:

  • Static Mesh Component named StaticMesh. This should be root of the Actor as well,
  • Sphere Collision Component named Sphere. Attached to Root.

WorldItemActor_Components

And those variables:

Var Name Var Type Default Value  Description
Item Item Object Class Storing link to the Item object. Used to create object. Expose on Spawn: True! Editable: True!
ItemReference Item Object Reference This will be referencing to created object from Item. Reference here means specific created Item.
bEnablePhysics bool Expose On Spawn: True! Editable: True!

Now here’s the trick how to show Item’s static mesh in editor without spawning it. Open Construction Script and add this:

WorldItemActor_ConstructionScript

So basically each item will have an Object and Actor interpretation. Quick example:

Find some Apple mesh. Create new blueprint extending from Item_Ingredient named Item_Ingredient_Apple make sure you have assigned WorldMesh to your Apple mesh. Then create new blueprint extending from ItemWorldActor named Item_Ingredient_Apple_WA. (WA here means World Actor) Open it and assign Item_Ingredient_Apple object to Item variable. Place the Actor in level and you should see Apple.

addingapple

At this point nothing will happen with the item but you should get the idea here. It would be much more simpler to generate those WA actors from Objects, but we don’t have possibility to create new data types in content browser from Blueprints. Another thing are thumbnails – UE4 is missing simple “Capture Thumbnail” in current component stage (after changing something in Construction Script) – without thumbnails it’s hard to find the items.

btw there is great way to change variables for more than one content browser item. Select more than one Item and choose “Bulk edit”

bulkedit

bulkedit_opened

Inventory

We need a place to store inventory items somewhere. I will use Actor Components for this at it can be attached to any actor.

But first I would need some structure that will store Items with their count in the inventory (example. have 2 the same items in inventory). Create new structure named InventoryItem:

Var Name Var Type Default Value  Description
Count Int How many Items do we have.
Item Item Object Reference Reference to the item.

 

Now create new blueprint extending from Actor Component named Inventory.

That’s all for now.

Communication

So you have the idea how the basics classes will work but what about communication? I will be using Interfaces to communicate from one blueprint to another. There will be two Interfaces one for UI (UMG) communication and one for in-game communication.

Before start create new ENUM named ItemCategory. It should contains:

  • All,
  • Weapon,
  • Armor,
  • Potion,
  • Ingredient,
  • Book,
  • Misc.

This ENUM will be used for UI only. You could try implementing UI without it but it will require more work.

Now create new Interface named IInventoryInHud and open it. It will contain 2 functions:

CategoryButtonClicked function:

  • Input Name: Type. Input Type: ItemCategory,

InventoryItemHovered function:

  • Input Name: Inventory. Input Type: Inventory Item structure,

Create another Interface named IInventory with those functions:

StartSelection (doesn’t have inputs)

EndSelection (doesn’t have inputs)

OnTaken:

  • Input Name: InventoryRef. Input Type: Inventory Component Reference,

OnItemSelected:

  • Input Name: ItemRef. Input Type: Item Object Reference,

DropItem:

  • Input Name: ItemRef. Input Type: Item Object Reference,
  • Input Name: OptionalDropCount. Input Type: int,

We will try to use only those interfaces to communicate within whole system.

Inventory Management

Base classes are done now let’s move into some Inventory management. Open your Inventory Blueprint and add those variables:

Var Name Var Type Default Value  Description
InventoryItems InventoryItem Strcture (Array) It will store all Items that are in Inventory.

Inventory should implement IInventory interface!

First lets add basics add and remove items from inventory functionalities. Create new function AddToInventory.

AddToInventory Function:

Inputs:

  • Input Name: ItemToAdd. Input Type: Item Object Reference.
Local Var Name Var Type Default Value  Description
Index Int It will store the index of the item in InventoryItems array if found the same item.
FoundTheSameItem bool Used to determine if we found the same item in inventory.
LocalItemToAdd Item Object Reference Just storing the input so it will easier to view the blueprint.

AddtoInventory

RemoveFromInventory Function:

Inputs:

  • Input Name: ItemToRemove. Input Type: Item Object Reference.
Local Var Name Var Type Default Value  Description
Index Int It will store the index of the item in InventoryItems for ItemToRemove reference.

RemoveFromInventory

Comments in screen should be enough. So this is basic Add / Remove functionality.

Drop Item IInventory (Interface) Event.

Now create new function named GetRotatedFrontPlayerLocation with:

  • Input: Int, Name: Optional Rotation Phase,
  • Output: Vector, Name: Location,
  • Function should be pure,

GetRotatedFrontPlayerLocation

What this does is basically picking a location in front of the player (Owner, because Inventory will be attached to Player as component) and rotate it based on Rotation Phase. Rotation Phase will be increasing when dropping items from inventory.

Now go to your event graph and add event from IInventory: Event Drop Item.

DropItemInInventory

It’s simple. When dropping item from inventory we need to create again World version of the item. That’s why I’m spawning ItemWorldActor with specific Item reference. Sequence is simple:

  1. Pick location in front of the player,
  2. Check if we can spawn something there,
  3. If yes: Just spawn the item,
  4. If no: get collision location and spawn near,
  5. After spawning – remove the item from inventory,

That’s all in Inventory Blueprint for now!

Adding Items Picking and Moving

Next step is to add possibility to select an item in world and add it to inventory.

Create new Widget named UI_OnItemSelected and Open it. Here’s the hierarchy:

Open Event Graph and add those variables:

Var Name Var Type Default Value  Description
ItemRef Item Object Reference Editable: Yes, Expose On Spawn: Yes
DisplayedInInventory? bool Editable: Yes. Expose On Spawn: Yes

And one function: SetItemRef with one Item Object Reference as Input:

setitemref

Now in Event Grap create new Custom Event named UpdateItem (update your SetItemRef to call this event!) and add Construct Event:

UI_OnItemSelected_eventgrap

It looks complicated but it isn’t. It’s just updating Text Values from the Item information, and checking if it’s Armor or Weapon to decide how custom text should look like. The first bool is used to determine if this widget is shown in Inventory UI (which we don’t have yet!) or game.

That’s all here!

WorldItemActor Update

Open WorldItemActor and implement IInventory interface. Add those variables as well:

Var Name Var Type Default Value  Description
HoverMaterial Material Reference  Your custom Material. Reference to the Hover material. Just create some material and add reference here!
NonHoverMaterial Material Reference This will store original item material.
bEnablePhysics bool
PhysicsInfluenceRadius float 15 Remember the Sphere component we have added earlier? This will determine the size of the Sphere.

Go to Construction Script and update it:

worlditemactor_components1

I’m saving original material and changing size of the Sphere. Simple as that.

Add Begin Play Event:

worlditemactor_beginplay

Now IInventory Interface events:

start_end_selection

It is changing the material and letting HUD know about the selection. (I haven’t touched HUD yet!) Last part here is to implement OnTaken event from IInventory interface:

ontaken

Simple as that – add selected item to inventory ping all item actors about physics and destroy item actor.

FirstPersonHUD

First person example comes with HUD blueprint named FirstPersonHUD. Open it and add one variable:

Var Name Var Type Default Value  Description
UI_OnItemSelected UI_OnItemSelected Widget Reference Store reference of actually selected item.

Implement IInventory Interface on the HUD and add those events:

HUDclass

It should be selfexplainatory.

FirstPersonCharacter – Take / Move Item

This will be most critical part. Character is responsible for communicating with inventory and items. Before you start make sure you go to Project Settings -> Input and add those inputs:

inputs

Let’s start from components:

Add Inventory component and PhysicsHandle component. You can remove the hands mesh as it’s just cover the screen unnecessary.

pawncomponents

Now new variables:

Var Name Var Type Default Value  Description
LastSelectedActor Actor Reference It will store selected actor in last frame.
NewSelection bool Determine if there was new selection or not.
MaxSelectionDistance float  250  Distance for picking up objects.
WantToGrabItem bool Stores if we want to grab an item instead of adding it to inventory.
ItemGrabbed bool Items is currently grabbed by player?
DeltaTime float Current delta time.
GrabbingAccumulatedDelta float It will determine if we are holding ‘E’ key special amount of time. (eg. after 0.5 s we want to grab the item)
HitResult HitResult Stores hit result of our crosshair.

And one function named GetItemOverCrosshair with:

  • Local Variable: LocalSelectedActor (Actor Reference),
  • Output Name: Result, Output Type: Actor Reference,
  • Output Name: Hit Result, Output Type: Hit Result,

getitemovercrosshair

It’s searching for IInventory items over the crosshair.

Now custom events. Create new Custom Event named GrabItem:

grabitem_01grabitem_02

It’s looking complicated but just read  the comments and variable names! This function is responsible for grabbing the item. (to move the item you would need to change PhysicsHandler location when item is grabbed – which will be done in couple of sec in Tick function!)

Create another custom event named ReleaseItem:

releaseitem

Simple as that. I’m resetting the variables just in case here!

Add Tick Event:

Tick

Here’s where the magic comes. It’s searching for IInventory Actors and calling StartSelection / EndSelection if found new IInventory Actor. It will try to grab the item as well but we are missing one important part from the input.

Add Use Input Event:

UseAction

At this point you should be able to add the item to inventory and grab it when holding ‘E’ key.

Adding 3d item view

Next thing I would like to achieve before starting to create UMG Inventory is to create a way to render 3d object in UMG. Currently there is no simple way to achieve this. I will use Render Target but with some “hacks”

First create new Render Target Texture named: T_ItemPreview (resolution 1024×1024) and M_ItemPreview Material:

m_itempreview

Now create new blueprint extending Actor named BP_ItemRecordingActor. Open it.

Components:

SceneCaptureComponent2D:

  • Location :(X=-50.000000,Y=0.000000,Z=0.000000)
  • Field of View: 60
  • Texture Target: T_ItemPreview

Point Light:

  • Location: (X=-80.000000,Y=-60.000000,Z=110.000000)
  • Intensity: 1
  • Attenuation Radius: 500
  • Light Color: (B=255,G=220,R=238,A=255)
  • Use Inverse Squared Falloff: False,

Scene Component named MeshRoot and Static Mesh Component named Mesh attached to MeshRoot.

itemrecordingactor_components

Open Event Graph and add those variables:

Var Name Var Type Default Value  Description
DesiredExtend Vector  18,18,18 Desired size of the object on screen.
CurrentMeshExtend Vector Current size of the object on screen. I would like to scale it do desired size.
bRotateEnabled bool  Is object currently rotated in inventory?
OnStartRotateLocation Vector2D It will store 2D coordinates of the mouse when started to rotate the item from inventory.

What I would like to accomplish here is to have a render target which will render my object to 2d texture. The problem is with assets different scale and pivots.

Basically if you will be in pro game development your graphics team will create specific 3d items for your inventory. With the same pivot and scale – to fit the screen (Screen = Texture in this example)  as good as possible. I’m not a graphics artist and I’m using meshes from packs. They have different scale and different pivots. My goal here is to have a system that will scale the items and move the pivot so I can render any object without thinking of the scale or pivot. Unreal is able to do that.

This event will be responsible for that. Create new Custom Event named UpdatePivotAndScale:

updatepivotandscale

Now add new Function named SetNewMesh with one Static Mesh input:

setnewmesh

It will be used when selecting items in inventory.

Now add custom events responsible for rotating the actor. They will be called from UMG Inventory:

rotationevents

And that’s all here. Now we need to spawn the actor somewhere.

Open Inventory Component and add those variables:

Var Name Var Type Default Value  Description
RecordingActorLocation Vector  (X=0,Y=2000000,Z=0) This will be spawn location for Recording Actor
RecordingActorRef BP_ItemRecordingActor Reference It will store reference to the recording actor.

Now add Begin Play and spawn recording actor:

spawnrecordingactor

Why I’m spawning it that far away? It need to be outside the sky sphere so we will get alpha in Render Texture.

Adding Inventory UMG

At this point functionality is there. Now we would need to implement Inventory UMG to show the inventory.  It won’t be so easy as Skyrim Inventory is advanced.

Base Inventory UMG

Create new Widget named UI_Inventory. Implement IInventoryInHUD Interface. For now leave it as it.

Category Button

Create new Widget named Widget_CategoryButton and go to Designer:

  • Delete Canvas Panel,
  • Add Button named Button_Category, (isVariable is True)
  • Add Text named Text_Type and add it to Button_Category,  (is Variable is True, is Focusable: False)

Go to Event Graph and add those variables:

Var Name Var Type Default Value  Description
CategoryType Item Category ENUM All Editable, Expose On Spawn.
InventoryRef UI_Inventory Reference Editable, Expose On Spawn,

Add OnClicked event to Button_Category:

OnClickedButtonCategory

This will let know Inventory UI that category button was clicked.

Now in Construct let’s change Text_Type text depending of the type:

CategoryButtonConstruct

That’s all here.

Item in List

Create another Widget named Widget_InventoryItemInList. Open it and delete Canvas Panel from Designer. Add:

  • Overlay on top,
  • Button named Button_Item (Align: Fill – both)
  • Horizontal Box,
  • Text named TextBlock_ItemName added to Horizontal Box, (Fill – both) Is Variable = true,
  • Text named TextBlock_ItemCount added to Horizontal Box, (Fill – both) Is Variable = true,

ItemInList

Open Event Graph and add those variables:

Var Name Var Type Default Value  Description
ItemToShown Inventory Item Struct Editable, Expose On Spawn.
InventoryRef UI_Inventory Reference Editable, Expose On Spawn,
bIsHovered bool

Add Construct Event:

ConstructItemInlist

It will check how many of the same item do we have.

Now add Tick event which will be responsible for hovering the item in list:

TickInventoryItemInlist

It would be simpler to have OnHover event in Buttons. I have requested this feature on the Unreal Engine 4 Forums. For now we need to use Tick to determine that.

Item Preview Widget

Create new Widget named Widget_ItemPreview. Delete Canvas Panel and add Image named Image_ImagePreview (Is Variable = True, Brush = M_ItemPreview material created earlier)

Make sure Is Focusable is set to False. Just click on Root of the Hierarchy. It’s needed as I will use TAB key to open and close inventory. TAB is used to control UMG widgets as well. Setting this to false will disable TAB to focus.

isfocusable

Add those variables:

Var Name Var Type Default Value  Description
OnClickMousePos Vector2d It will store mouse position when clicked on Widget.
ItemPreviewActorRef BP_ItemRecordingActor Reference Storing reference to Item Recording Actor.
bIsHovered bool  Store if Item is hovered currently.

Now in event graph go to functions and click Overwrite On Mouse Move Function:

OnMouseMove

This is how I’m communicating with Recording Actor to rotate the Actor.

Overwrite On Mouse Button Down:

OnMouseButtonDown

Overwrite On Mouse Button Up:

OnMouseButtonup

Now in Event Graph add On Mouse Leave event:

OnMouseLeave

This will be called when our mouse will leave whole widget. That’s all here!

UI_Inventory Preparation

Now go back to UI_Inventory and try to recreate my hierarchy:

Go to Event Graph and add those variables:

Var Name Var Type Default Value  Description
bHasItem_Weapon bool
bHasItem_Armor bool
bHasItem_Potion bool
bHasItem_Ingredient bool
bHasItem_Book bool
bHasItem_Misc bool
InventoryItems Inventory Item Struct ARRAY Storing all inventory items.
ActualSelectedItem Inventory Item Struct Storing currently hovered item.
CurrentOpenedCategory Item Category ENUM Storing currently opened category.
ItemDropCount int Storing how much items did we drop when in inventory.
Inventory Reference Inventory Component Reference

Open Event Graph and add Category Button Clicked from IInventoryInHUD interface event:

CategoryButtonClicked_00

This will be responsible for showing items depending on which category we have clicked. The first one is All. Here’s next:

CategoryButtonClicked_01

I won’t be showing rest as it’s only changing Cast To – Specific Type. Try to fill the rest switch.

Now add new Custom Event named AddCategoryButtons:

AddCategoryButtons

I won’t be showing rest as it’s only changing the bool type and category type. You should figure this out.

Add another Custom Event named Clear Data:

ClearData

And another one named AddAllCategoryButton:

AddAllCategoryButton

This will add “ALL” category button.

Add another one named UpdateCategoryItems:

updatecategoryitems

It will search for all items and select if we have Weapon, Armor etc.

Add another one named UpdateData:

UpdateData

In Construct:

Construct

I have directly set variable in Widget_ItemPreview you should use Function for that!

Add another one Custom Event named TABInput:

TabInput

And another named DropInput:

DropInput

Now add Event from IInventoryInHUD Interface named Inventory Item Hovered:


InventoryItemHovered_0
InventoryItemHovered_1

I have separated it for 2 parts.

Yes – managing UMG in Blueprints is really hard.You can spend days to improve your Blueprints visibility. I assure you that this can be done much more easier. Just understand how it works and try to create it by yourself!

Last thing here is to get “E” and “TAB” events. Currently UMG doesn’t support Inputs from Project Settings so you need to Overwrite On Key Down Function:

Add one local variable named LocalKeyEvent extending from Key.

OnKeyDown

And that’s all here!

Triggering Inventory UMG

Now we need to somehow open inventory. Open FirstPersonCharacter Blueprint and add UI_Inventory variable extending from UI_Inventory Reference.

Add Input Action Inventory:

InputActionInventory

And that’s all. You have Skyrim like inventory completed!

Assets

I have used Bumping Pub for showcase. The pack isn’t modular but it’s great for showcasing things! Shield has been found here and weapon here.

You can found ready to use Inventory in Marketplace as well. I have done this for you for free and hope you will learn from it! 

Final Result

Creating ShooterTutorial takes a lot of my free time.
donateIf you want you can help me out! I will use your donation to buy better assets packs and you will be added to Credits /Backers page as well. Implementing game is taking time but writing about it is taking much more effort!

107 thoughts on “Complete Skyrim like inventory Tutorial

  1. Pingback: Tutorial Spotlight: Full Skyrim-Style Inventory for UE4 | Storyteller VR

  2. Can someone please help me in the right direction here, im stuck at this point.
    I’ve spent hours on google to find a the right way. But everybody else have another way to make this referenge blueprint ;(

    This one –> “make sure you have assigned WorldMesh to your Apple mesh.”

    And the one below:

    (“Then create new blueprint extending from ItemWorldActor named Item_Ingredient_Apple_WA. (WA here means World Actor)

    This one –> “Open it and assign Item_Ingredient_Apple object to Item variable. Place the Actor in level and you should see Apple.”)

    Best regards

    • “make sure you have assigned WorldMesh to your Apple mesh.” – WorldMesh is a Static Mesh Reference – you need to assing some mesh into it (Apple in this example 🙂 )

      Then create new blueprint extending from ItemWorldActor named Item_Ingredient_Apple_WA. (WA here means World Actor)
      — Just right click on ItemWorldActor and select “Create Blueprint Based on This Class” – this will create new blueprint for you based on ItemWorldActor. Just name it Item_Ingredient_Apple_WA.

      Open it and assign Item_Ingredient_Apple object to Item variable. Place the Actor in level and you should see Apple.”)
      – When you open Item_Ingredient_Apple_WA you need to assign Item variable – this means your apple item object reference.

      • I just figured out that i forgot to make the variables public!

        But thanks alot for your help Andrezej 🙂
        Keep up your awesome work!
        Big thumbs up!

  3. Thanks! We really appreciate your hard work! Your tutorials have helped me numerous times. Seeing someone else work on a project by them self really influences my friend and I when we are working on ours.

    • I think I got it but please explain just to be clear.

      Also how do you add an Inventory Component to the First Person Character?

      Great Tutorial – Wish you a happy New Year.

        • Awesome but very tricky tutorial. I made some adjustment that I hope you will find helpful.

          First of all when you open the inventory while looking at an item you get the widget UI_OnItemSelected twice, as shown in the image below.

          http://i.imgur.com/Lp2xBOe.png

          What I did to overcome this is the following.

          Go to your First Person Character blueprint and add the following variable.

          Title – bIsInventoryOpen / Type Boolean

          Go to the event InputActionInventory and update it to the picture below.

          http://i.imgur.com/lHENjOU.png

          Since the Player Controller always creates widgets, I felt there was no need to check if it was valid or not, plus it bugged out some other things I implemented. All in all it makes for some cleaner blueprint. Don’t forget to set the bIsInventoryOpen to TRUE at the end.

          Then go to the EventTick and update it as shown in the images.

          Part 01 – http://i.imgur.com/VCw9n6b.png
          Part 02 – http://i.imgur.com/8GnSZGt.png

          What we actually do is check if the inventory is open. As soon as it is open, we remove the widget UI_OnItemSelected that was spawned when we looked at an object and we bring it back as soon as we close the Inventory by resetting the doOnce node. But for all this to work we have to do one last thing.

          Go to the UI_Inventory widget and update the Event InventoryKeyInput, by adding nodes as shown in the image.

          http://i.imgur.com/2FWj45L.png

          What we do here is basically setting the bIsInventoryOpen (from the FirstPersonCharacter) as FALSE, we state that whatever you trace is a new selection NewSelection TRUE (from the FirstPersonCharacter) in effect resetting the loop of the event GetItemOverCrosshair and finally we call the event GetItemOverCrosshair.

          Hope this helps 😉

      • Hello, can anybody help me out? When I add my “inventory Component” to the first person character it only comes up as child actor and wont link to Inventory reference in “OnTaken” in the Inventory Interface.

  4. Thanks a lot for the tutorial!

    I am having some difficulties with picking up objects however and I have no idea what is going on, but I think it has to do with the PhysicsHandle. Whenever I pick up an object, it shoots away and is located much further away than it actually should and doesn’t really stay in the center as I would like it to. Do you happen to know why this is happening?

    Thanks again for the tutorial and keep up the good work!

    • Try to check your mesh collision – maybe it’s to big or to complicated. In the first part of the tutorial I have linked great PhysicsHandle tutorial which can be used if you have issues!

  5. Hi there, great tutorial!
    I am having some trouble with the Inventory component reference. I have added one to the character blueprint using the add new blueprint script component (I am not sure if this is correct?). I then set the input of the IInterface ‘ontake’ to the same component (again unsure if this is correct). However, there is then a problem with the ontake event function described for the worldactor as the ‘add to inventory’ function is a separate blueprint (not the component).

    My main question is should my Inventory blueprint and the Inventory component be the same thing? And if so how is this done? I have tried adding the inventory blueprint as a component to the character but this does not seem to work properly. I hope this makes sense and that you can help!

    • You need to add Inventory Component to Character. (In components view just add earlier created Inventory Component)
      Add To inventory is function IN Inventory Component. Inventory Manager is Inventory component.

      • I have another question! In the UI_Inventory event ‘UpdateData’ how do you connect the inventory reference to the set inventory with what looks like a get (but with a target)? When I try and connect the Inventory Reference (Component) and the InventoryItems (Inventory Item Struct Array) the two are not compatible, so it doesn’t work… Any ideas?

  6. Pingback: [UE4] Skyrim Like Inventory Tutorial - :::::..... Gaming Resources .....:::::

  7. Me again! I completed your tutorial and it works brilliantly (almost). Currently when I am opening my inventory the buttons come up correctly, including the category names etc. as do the names of the items. The widget preview also gets displayed, however, for some reason 1) the preview does not always show the object, 2) when the object is shown it experiences a weird distortion and 3) it shows the skylight as well as the object. After doing some debugging I’m still unsure as to why this is happening. The hover buttons are definitely working but there seem to be some cases where the cast (in order to write the correct text for the use/drop/etc.) doesn’t work. I discovered this by setting the final cast’s fail node to a “Cast Failed” and this appears several times.

    I also thought that perhaps the reason the widget is not showing the item is due to it falling as soon as it has spawned but I don’t think that this is the case (I tried setting simulate physics to off) but I may have missed something. Hopefully you may be able to answer me.

    Thanks again.

    • 1. You need to check your scale of objects and pivots – my calculations for scaling / changing pivot are placeholder. Normally you would need to have your items in the same scale and with the same pivot. (as in Skyrim)
      2. Can you show a screen? As far I know RenderTarget texture isn’t adding postprocess,
      3. I can’t remember now correctly but I remember putting the camera so it will point outside skysphere,
      4. Make sure when spawning you have checked “Spawn Always” (or something like that) in your spawn actor options.

      I have recreated this from tutorial using clear project and it’s working. Debugging is really important part in game creation – place print strings and invest time to figure this out. I know that this isn’t any help from me but I can assure you you will learn much more without my help.

  8. So I managed to get mostly everything working, thought I would post my answers in case anyone makes silly mistakes (like I have). Firstly the object was not showing because I hadn’t unticked ‘Enable Gravity’. This meant the object was falling as soon as I spawned it. Secondly I changed the pivots, scales and field of view of the scenecapture component. I suggest to anybody having problems that you spawn the inventory actor within your level (so you can actually see it as a player) and then mess around with things (at least that’s what worked for me)

    However, I’m still having a problem with using the alpha of my render target texture. The actual texture has no alpha channel (well its a block white/black) and after doing some research it seems that the SceneCapture2D component doesn’t create an alpha channel? How have you done this?

    • Create new level and put your RenderTarget to empty level – you will have alpha then :> Just test it out. When you have skybox you need to place your render target outside the skybox to get the alpha.

  9. Now go to your event graph and add event from IInventory: Event Drop Item.

    I apologize in advance, I am still new to Blueprints. I am stuck on this part. I double checked, and I did everything up to this point correctly, but I assume that you are adding that event, to the event graph in the Inventory Blueprint? Problem is, I have searched high and low and I have no idea how to add an event from one blueprint to another.

      • Thanks man! I’m adding this to my school assignment, but even doing this is a great learning experience.
        The next part though, Cast to Item_Weapon. Adding an interface didn’t help, and I didn’t see anything up to this point, that’d have me create item_weapon. The closest thing that pops up is just cast to Item and cast to Item class. Sorry for being such a noob >.<

  10. So, I am at the World Item Actor Update part of this tutorial. I set Non Hover Material, but when I try to plug in Get Material (Target is Primitive Component, it wont let me. It says, Material Interface Reference not compatible with Material Reference. Any ideas guys?

  11. Hi…I finished the tutorial but,

    -my widget Item preview accessed none.
    -UI Item Selected details accessed none.

    these are majority of the errors I am getting

  12. Great tutorial… No matter what distance I use for the screen capture, or if I create the screen capture in another level, there is not a legitimate alpha on the Screen Capture, and the 1-x into the opacity of the material for the 3d screen does not work. It makes the entire image invisible. Any suggestions or is this a 4.10 engine change issue?

  13. I finished this awesome tutorial, but when I press “Tab” for show the inventory, appear two errors:

    1- “Infinite Loop detected in UI_Inventory, asserted during ForEachLoop with the following Call Stack”

    2- “Accesed None ‘ItemRef’ from node SetText (Text) in graph ‘EventGraph’ in blueprint UI_OnItemSeleted.

    Sometimes Unreal Engine crash too and need restart. I dont understand because I have the blueprints exactly as it appears in the images.

    the first error, if I break the link “UpdateData Custom event” with “Clear” (in UI_Inventory Blueprint), the error disappears, but the inventory is not displayed, and maintains the second error.

    Some idea? =(

    • OK. I thought id leave this here incase anyone else is trying to resolve this issue with “ItemRef” not containing anything and not do what I did which was spending 3/4 of a day ensuring I did everything correctly.
      My error occured in the Widget_InventoryItemInList so may help, turns out in “UI_Inventory” on event CategoryButtonClicked I did not plug in ArrayElement from “ForEachLoop” to the ItemToBeShown from “CreateWidget”.

      Hope this helps and I urge others to read through the tutorial carefully and slowly as the creator has mentioned.

      Much Love!

    • I have The same problem!!

      2- “Accesed None ‘ItemRef’ from node SetText (Text) in graph ‘EventGraph’ in blueprint UI_OnItemSeleted.

      And I have plugged in ArrayElement from “ForEachLoop” to the ItemToBeShown from “CreateWidget”. But the problem is stil there..

  14. I am stuck on the Overwrite On Mouse Move. When i drag off the on mouse move node I don’t have the 2nd On Mouse Move node, or an On Clicked End node

  15. Hi I am also seeing the error for the text …….“Accessed None ‘ItemRef’ from node SetText (Text) in graph ‘EventGraph’ in blueprint UI_OnItemSeleted.

  16. Having an issue with getting the static mesh to be assigned to the world actor, doesn’t seam to be doing anything. Yes they are exposed on spawn and editable. Construction script is correct. Only difference I have with your code is putting BP in the name. Suggestions

  17. Hi all, Kashif here… ANDRZE.. ANDRZE… ANDRZE… let me say this to you i followed both your long tutorials of Shooter Inventory and Skyrim inventory to the end.. i have to say is that your working too too hard NOT SMART. by that i mean in your tutorials you not adding TROUBLESHOOTING EVENTS along the way to make sure things actually work..They actually might work for you in the end but it does not work for people in the end.. why because along the way your not troubleshooting to see if things actually work the way they should as you said, so my advice to you is in your next tutorial please please please for the love of God add some troubleshooting events to see of things are working right. your working too too hard not smart. you want to work hard and smart at the same time., i am available at kkamal25@gmail.com to discuss this comment with you further.

    • Finished the whole thing in 6 hours xD have a bit experience with blueprint but this took it to aonther level. And idk why it still stuck in Inventory when i TAB i click TAB again and it wont even fire off input action.

  18. Is there any chance that you could post the project files for the project? I followed through the entire tutorial, then there were some problems. I was debugging to try to fix them and now when i press play the editor crashes Even after undoing the changes that I made.

    Thank you immensely for the tutorial, it is amazing. I would be greatly appreciative if you could post the files 🙂

  19. Guys, i am in trouble on “If Item is Object how to add it to level?” on the script part, the error says “Error: Wrong class to spawn ‘/Game/FirstPersonBP/InventorySystem/Blueprint/Actors/MasterItems/BP_Item.BP_Item_C’ in Construct Object from Class” what do i do?

    • Please disreguard my comment, the structure I was using was from another tutorial I was following. It was making an inventory structure, but I wasn’t at all happy with the result.

  20. I can’t get the command “GetHud” to work with the script. I thought at first that it was because I was using a thirdperson blueprint, but even after I switched to a firstperson blueprint with the first person HUD, I still get this Error: https://puu.sh/qdIG5/9c9730a312.jpg Can I get any help with this? And is there anyway to make this work with a Third Person Blueprint?

  21. Thank you so much for this tutorial!!! Works totally fine for me!
    I just have one silly question : why should we use Objects instead of Actors? Is it “Object Oriented Design” instead of “Actor Oriented Design”?

    I don’t have much coding background so please forgive me for this dummy question..
    Thank you in advance!

    • So to answer your question, object oriented design in terms of coding is not exactly what many may think.

      It doesn’t actually refer to an actual object, but rather a section of self-contained code.

      Many of the most popular and widely used coding languages are object oriented. Like Java, Python, C#, C++ and many others.

      My professor told me a good way to think about it is like if you’re repairing a car.

      There are many individual pieces that connect and interact in different ways to form a cohesive and functional unit.

      Some pieces serve numerous uses, or bridge several other parts, some can be used in different areas of the vehicle, and some only do one specific task.

      UE4 is also object-oriented, hence why blueprint nodes are a thing. this style of programming is what allows devs to reuse the same functions or references many times over.

      To answer the other part of your question. An object is simply a coded reference linking it to an actor. And Actors contain the actual 3d assets.

      Hopefully this clears it up a little

  22. I’m having this problem where no matter what my crosshair doesn’t interact with the world model. I’ve followed this tutorial through three times and I’m completely at a loss for what to do. There are no error messages, nothing to debug or anything. I place the world model and my cursor never picks it up. Any idea’s for where I might look for errors?

    • I am having the same exact issue, The item cant be interacted with at all. Went through the tutorial multiple times and still no interaction for picking up items, also noted that if the inventory is empty and you click “all” the game errors out on the hud, No check for a empty inventory is cUsing the problem there.

      Would really like to know why the interaction hud isnt coming up on mouseover though, even increased the mouse over max distqnce to 600 and no avail. Object has collision, I turn on physics and it will fall and move around the world. Any help on this would be appreciated, but it looks like this tutorial has been long forgotten. Using ue4 10.4.0

  23. I noticed that i’m not the only one having this particular problem. Everything works fine but i cannot manage to close the inventory after i press tab. The game get stuck and i must restart!

  24. I know this is very old but I would like to get this working for learning material for college. I’m getting error of accessed none on UI_OnitemSelected, also none of my world items are showing up anymore They were when I started the tutorial, but now they only show as the collision sphere. my email is Kohr_Ryan2876@yahoo.com if anyone could help.

  25. Hello, so for now I am stuck when trying to connect the “Get HUD” node to “On Item Selected”-“Target”. It tells me it can only be a “self reference”. What did I miss ?

    Please help, thanks ! 🙂

  26. Anyone can help me?
    I made the tutorial, but when i finished it and i press TAB, my game frozen, i can’t press another button and i can’t click on my categorys buttons

  27. At the moment I followed the tutorial up to the point where the 3d item view will be added. I am on a Third Person project. For me the GetItemOverCrosshair function does not work. I used the ‘follow camera’ of my character instead of the mentioned one because it’s a third person game. But the result of the LineTraceByChannel is always false even if I’m ‘starring’ at an object that is an ItemWorldActor. Any help please?

  28. Guys, i resolve almost all of my problems with this tutorial, but i still have one:
    The image in 3D of the hovered item does not appears, any ideias how i can resolve that?

  29. Pingback: [UE4] Skyrim Like Inventory Tutorial | :::::..... Gaming Resources .....:::::

  30. I can’t get the items to actually add to the inventory. The code stops at the “isValid” block before onTaken. Even bypassing the isValid still doesn’t destroy the actor and add it. onTaken doesn’t start at all with simulation on. What could make the lastselectedactor not valid??

  31. I can confirm, as is it can work in UE 4.15.1 I have everything working with item preview on transparent background and rotating, drop etc.
    This tutorial is correct, however as tutorial should be better explained with more screens.
    You have to check every stage many times for errors and some moves are confusing. For me, key problem was add inventory component to your character, because firstly I add actor inventory, not actor component invenotry – this is big difference of course.
    Anyway – it working nice – good work Andrzej! 😀

  32. At location where you have written “Create new Custom Event named GrabItem:” below that , the second image should be directed to “https://i2.wp.com/shootertutorial.com/wp-content/uploads/2015/12/grabitem_02.jpg” currently its set to 01 image 😛

  33. Good tutorial. I have one problem, i’m using 4.18, I can’t add items to my inventory. I can pick items up, but can’t add them to my inventory, my actor doesn’t get destroyed. Anyone who can help?

  34. The get hud into On item selected pin combo is a blue into yellow. Does not connect. It looks like OP stopped supporting this tutorial though, so commenting/requesting help may be pointless. But… If someone DOES come and see this… Send Halp!

  35. Hello!
    I know this is old, but i found the solution of two recurrent problems in the comments section. I hope it helps.

    – “Accessed None ‘ItemRef’ from node SetText (Text) in graph ‘EventGraph’ in blueprint UI_OnItemSeleted.

    In the ” UI_Inventory” go to “UI_OnItemSelected” Component. look for the default category and check the box “DisplayedInventory?”. That variable must be TRUE! It worked for me.

    – The TAB input doesn’t close the Inventory and get stuck.

    Go to the widgets “Widget CategoryButton” and “InventoryItemIn List” and set the buttons “Is Focusable” to false. Not the widget, the button itself. Also worked for me.

    This system works in 4.20!

    Bye!

  36. Im having trouble in the communication part. Under the Interfaces in the inputs im having trouble finding:

    CategoryButtonClicked function:

    Input Name: Type.

    InventoryItemHovered function:

    Input Name: Inventory.

    OnTaken:

    Input Name: InventoryRef. Input Type: Inventory Component Reference,

    OnItemSelected:

    Input Name: ItemRef. Input Type: Item Object Reference,

    DropItem:

    Input Name: ItemRef. Input Type: Item Object Reference,
    Input Name: OptionalDropCount. Input Type: int,

    Im having trouble finding the Inputs Pin Types for all of these. Are they just worded weirdly for Pin Types i have already created or are already available. Or did i maybe miss a step or maybe i have to create some of these?

  37. So i know this is rely old but u know gold its gold … 😛 ! Joke aside for every1 who have problem with 3d view in inventory look in “Item_Record_Actor” Rote mesh is in front of screen capture (X way i think red arrow)

  38. I spent the whole day on this article (why the article? – because the inventory is not working correctly, if you still take into account that not all aspects are shown)
    Very strong drawdown of the FPS, in general I do not recommend this lesson.
    Worked on version 4.24.1, possibly because of this and problems.
    This is what I needed, but due to non-operability I will have to abandon the venture.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.