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:

[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:

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:

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


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:

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.