Godot Version
4.3
Question
I’m kinda surprised and frustrated, because this is one of those things I assumed would work as a basic feature until I learned the other day that it doesn’t. So now I’m curious about the engine limitations or if I am misunderstanding this entirely.
One of the best things about exported properties on Nodes or Resources, is the ability to edit them at runtime, and see those changes occur in the game for testing purposes. Things like names, health, jump force, run speed, damage, money; anything is editable and testable. I can change the player’s HP in a Resource and boom: the UI changes, the character sprite displays the correct state, and anything else.
BUT if I export an Array[Resource], that can contain any custom Resource object such as: Status Effects, Items in an Inventory, or Quests in a Quest log; this does not work. I can technically change the array all I want during runtime, but the changes will never update until I’ve closed the running instance and re-play the scene. Everything that exists in the array when the scene is played will be initialized, but after that nothing change-able from the editor. (you can still change from code)
Furthermore, if you choose not to type the Array, and manually fill it with type “Object” from the editor, and drag your Resource in, this actually does let you change the Array during runtime, BUT once edited, it replaces every element of type Resource in the Array with an “EncodedObjectAsID” which serves as a reference to the Resource object, instead of the object itself. (which also prevents me from using Resource objects as constants representing types.)
Arrays of primitives like ints, floats, Strings, and bools will work just fine, which makes me think the problem lies with the Resource objects inside an Array.
Is there really no way to edit an exported Array of objects at runtime, and immediately see the changes?
Thank you for your time.
p.s. if you wanted to test this for yourself, it’s fairly simple: create an @exported my_array Array[Resource], and a timer that prints your array every 1.0 seconds or so. Play the scene and play around with the array; add/remove elements, drag/drop Resources from file system, nothing will change.