Simple Pickup System and Inventory System Unreal Engine 4 – Part 1

In this series of posts, I will be creating a simple Pickup system and Inventory system in Unreal Engine 4. This is targeted to the beginners in Unreal Engine 4 who want to create simple pickup system in game environment which interacts with our character player and adds pickup to the game inventory.

In the very first part, we will create a pickup which we can add to game environment. When our player interacts with this pickup, then pickup is destroyed from environment.
Lets start making our first simple pickup system using following steps.



  1. First of all create a blueprint class of type Actor. Name this as “Pickup”. Open your newly created Pickup blueprint.
  2. Add a Static Mesh component into the scene of your Pickup blueprint. This mesh will represent the pickup which you want to add into your game level.
  3. Also add a Sphere Collision component into the scene. This will be used to detect interaction of pickup with the player character.
  4. Your pickup blueprint will look like something in screenshot below.
    Simple Pickup System and Inventory
    Simple Pickup System and Inventory

     

  5. Now click on Sphere, and go to details Panel. You’ll find “On Component Begin Overlap ” event in Events section of details panel. Click on it and it will open in the Event Graph of your Pickup Blueprint.
    Simple Pickup System and Inventory
    Simple Pickup System and Inventory

     

  6. Now on Begin Overlap Event, you need to find out whether the character is overlapping the sphere component  and if yes then you can destroy your pickup after adding it to inventory. We will cover the inventory portion in next posts.
    Inventory System Unreal Engine 4
    Inventory System Unreal Engine 4

    What is happening here is , we are checking whether the other actor which is overlapping Sphere component is the Player character. If true, then destroy self. That means destroy pickup from game environment.

  7. Now next step you need to do is add a static mesh to the component that we defined in second step.
  8. Play with Sphere settings to change its radius so that the Static mesh for pickup lies inside the Sphere component. It will look something like below :
    Simple Pickup System and Inventory
    Simple Pickup System and Inventory

     

  9. Now you can drag your Pickup blueprint and add into your game level by dropping the blueprint into the level.
  10. You’ll find out that all your pickups are having same Static mesh. What if you want to have different static meshes for different pickups. Go back to your Pickup Blueprint and add a new variable of type Static Mesh to it. Name it “Pickup Mesh To use”. Make this variable public.
    Inventory System Unreal Engine 4
    Inventory System Unreal Engine 4

     

  11. Now every time you add a Pickup into your level, you’ll have an option to select a static mesh in the details panel of the pickup that you’ve added. This is not it, you need to pass this selected mesh to the Static mesh component that we created in second step. We’ll do it using Construction Script in our pickup blueprint. Drag Static Mesh component into your construction script, and drag wire from it to search for “Set Static Mesh”. Pass “Pick Up Mesh To Use” as New mesh to this node. Your construction script will look like following.
    Simple Pickup System and Inventory
    Simple Pickup System and Inventory

     

  12. Now you are good to go. You can select a different mesh for each Pickup that you’ll drop into the level.

If we are going to destroy the pickup on interaction with Character then it is obviously of no use. So in our next post , we will add our pickup to the Inventory and will show up our Inventory on pressing I button. So stay tuned for the next post.

Please help me to improve my posts by asking any questions if you are facing any difficulties while following these steps.  Thanks for your time. 🙂

Social sharing
Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInPin on PinterestShare on RedditShare on TumblrEmail this to someone

6 thoughts on “Simple Pickup System and Inventory System Unreal Engine 4 – Part 1”

    1. If you are referring to equality node, then it is taking 2 inputs (blue) and matching them and returning response in red wire (i.e true or false)

  1. Hi there,

    I’m having an issue where “Static Mesh To use” won’t connect to ‘New Mesh’. The variable is public.

    Thanks!
    Ishani

    1. Hi Ishani,
      Sorry for late reply. You should first confirm that you are using the right “Set static Mesh” node and variables are at right place. If you can screenshot me your blueprint, I can help better.

Leave a Reply

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