Announcement

Collapse
No announcement yet.

Inventory System works normally in PIE but not when packaged

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Inventory System works normally in PIE but not when packaged

    Hello all!

    So total noob in UE4 engine here, trying to make my first game in it, so sorry if I'm posting this in the wrong session or it lacks some info, feel free to ask any logs to help me solve this.
    So the problem is, I implemented this inventory system VIDEO HERE and it works normally in PIE, but when I package the game or run the game in a separate process when I pick up an item, it doesn't go to my inventory.

    I've searched a little before posting this and according to some posts in this forum it may be because UE do some variable settings on PIE and not when packaged, but I have no idea where to begin debugging to find this problem. Some people said that the OutputLog shows limited information and looking at it I couldn't find any errors that is related to the inventory blueprints but I think it's because the log is full of other things like Shader Compiling and I might have missed, so maybe there's a better way to see logs?

    Anyway, I hope this is enough to give you guys an idea of the problem.

    Thanks in advance!

    ----- EDIT ----

    After some digging (because I'm trying to solve this for the past 2 days haha) I figured out how to get a Log that actually helps and found out that the problem is this:
    Code:
    [2020.06.09-02.48.27:422][ 88]LogScript: Warning: Script Msg: Attempted to set an invalid index on array Inventory [-1/15]!
    And found that this error happens in this nodes:


    Click image for larger version  Name:	InventoryBug_BP.png Views:	0 Size:	60.1 KB ID:	1773353

    After putting Index as 0 it works by always putting an item in the first slot of the inventory, so it seems that the problem is that Inventory array is not populated with a bunch of "empty" slots that it should have, since I make this prepare:


    Click image for larger version  Name:	InventoryBug_BP_Prepare_01.png Views:	0 Size:	80.7 KB ID:	1773354
    Click image for larger version  Name:	InventoryBug_BP_Prepare_02.png Views:	0 Size:	71.5 KB ID:	1773355

    And the prepare is called onBeginPlay in InventoryBlueprint that's attached to my PlayerCharacter:

    Click image for larger version  Name:	InventoryBug_BP_Prepare_03.png Views:	0 Size:	49.3 KB ID:	1773356

    Click image for larger version  Name:	InventoryBug_BP_Playercontroller.png Views:	0 Size:	19.7 KB ID:	1773357

    So how I fix this?

    --- EDIT after a long night ---

    I didn't found the problem with the array initialization, but resolved my issue by making a function that gets me a empty slot:

    Click image for larger version  Name:	InventoryBug_BP_Solution.png Views:	2 Size:	53.7 KB ID:	1773359
    Click image for larger version  Name:	InventoryBug_BP_Solution_02.png Views:	2 Size:	87.6 KB ID:	1773360
    Last edited by HeronZ; 06-09-2020, 04:28 AM.

    #2
    Some times I have problems like those to, any idea?
    Some cool unreal projects you may like!


    Developer of GOTA - Survivalism Gladiatorial game Buy the game google gladiators of the arena steam https://store.steampowered.com/app/7..._Of_The_Arena/

    Download the demo Download the demo
    external link Dropbox DropBox

    Become a c++ Professional now C++ Networking Tutorial

    Comment


      #3
      Originally posted by Neongho View Post
      Some times I have problems like those to, any idea?
      So, I don't know the real problem with this, but I found a solution for this particular case, check out my last edit.

      Comment

      Working...
      X