I have an array of objects that all implement the same interface called ‘Lootable’. This array is a fixed [20] and has the default value ‘None’. The array is a variable on a blueprint called ‘Inventory’, and this inventory is a variable on my TopDownCharcter blueprint.
I add items to this inventory on runtime and show them visually in a temporary widget blueprint which gets updated when charges happen to inventory. This disappearance is something that happens outside my scripts however so my update-function is not being called.
I’ve made a simple function that prints a string when the disappearance happens. This function runs on the tick-event and spams a string after a value has been added but suddenly disappears:
Debug function
On Event BeginPlay I run a Setup-function that instantiates the inventory and this is the only place Inventory gets created. The time it takes for values to disappear is random but usually within a minute (sometimes instantly) which leads me to believe that the bug is correlated to some heartbeat-function that runs by default in the editor, but I’ve been unable to figure out a solution on my own.
The issue seems similar to the problem from this thread: https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/120218-private-variables-losing-values-resetting-to-defaults-during-runtime
I’ve found other threads with similar issues where it was suggested that deleting the /Project/Saved or the /Project/Saved/Config folder might fix the problem. This did not help in my case however so I decided to ask here