I’m trying to keep some switches activated if they were activated in anytime after the level reloads. The error I found by using Print strings is that once the level is reloaded the game instance does not recognize the switches as the same that were destroyed, it just add new switches to the array. I feel like this is really simple but I’m missing something.
Thanks for the answer, however it still does not seem to work the way I intended. Also, I have kept values of variables from level to level using just GameInstance, and the array keeps adding switches when they are activated, the thing I struggle with is that when I reaload the level the GameInstance does not regocnize the previously activated switches as the same ones, instead it add new vars of that type to the array as they were different switches when I activated. What I want is just that when I cast the GameInstance and call the function “Is Switch Activated” it recognizes the switch from the array so the funcion returns true and the switch gets destroyed.
Edit: I disconnected the destroy self node and even without reloading the level the game instance still adding new switches to the array shooting at the same switch, so I think the error is there, in how to differentiate the instances in the level.
By using Open level by name, I finally kinda fix it using an integer array in the GameInstance and giving each switch that I instantiate an unique integer, even tho it’s not exactly what I wanted