Resource data is removed from array during runtime
Hello everyone, I would like to thank you in advance for any help provided.
I have a resource class SummonData inherets ActionData, which is inside an array of another resource CharacterData.
So the code of SummonData looks like this:
class_name SummonActionData
extends ActionData
export var character_prefabs:Array[PackedScene]
func copy(other:ActionData) -> void:
super.copy(other)
var other_summon_data = other as SummonActionData
character\_prefabs = other_summon_data.character_prefabs.duplicate()
func get_duplicate() -> SummonActionData:
var dup := SummonActionData.new()
dup.copy(self)
return dup as SummonActionData
These resources are assigned before running the game. So the structure looks like this.
Character -> character_data:CharacterData -> action_data:Array[Action] (contains my SummonData)
When I load the Character in runtime, the the array cleared itself. And I got an error message in the console :
E 0:00:00:0509 validate\_object: Attempted to assign an object into a TypedArray, that does not inherit from 'GDScript'.
<C++ Error> Condition "!other_script->inherits_script(script)" is true. Returning: false
<C++ Source> core/variant/container_type_validate.h:140 @ validate_object()
E 0:00:00:0509 assign: Unable to convert array index 0 from "Object" to "Object".
<C++ Error> Method/function failed.
<C++ Source> core/variant/array.cpp:238 @ assign()
Another weird thing is when I put a break point at _ready (so I don't think any of my code is doing any thing crazy) and trying to inspect the data, from the character level, the array is intact, but from the character_data level, it array is empty(Again the character_data is a private property of character, so im not sure why they are different) The below screenshot might better understand what I meant:
Character
CharacterData (inside the character
I did some search on google and found this https://forum.godotengine.org/t/error-object-not-inherited-from-gdscript-triing-to-asign-to-typedarray/77629, but none of the solutions helped.
Does anyone also encountered this issue?