Godot Version
4.6
Question
Hi everyone!
I’m trying to cast an Arrayas Array[TacticsAction]but Godot still doesn’t recognize the content of best_plan[NodeKeys.ACTIONS]as Array[TacticsAction]:
var best_plan_actions: Array[TacticsAction] = best_plan[NodeKeys.ACTIONS] as Array[TacticsAction]
The engine throws an error:
Trying to assign an array of type “Array” to a variable of type “Array[TacticsAction]”.
The content of best_plan[NodeKeys.ACTIONS] it is indeed an Array, and its members are indeed TacticsAction. The best_plan is a Dictionary, but I didn’t type its values because they are of different types: one is an int, the other an Array, etc. I thought that casting it as an Array[TacticsAction] would be enough, but I guess I’m wrong.
Do I have a proper way to cast it as I want?