Does anyone know how I do this from a c++ module for Godot 4?
@export var typed_test:Array[State]
When I code this in gdscript I get Typed Array in the inspector asking for the State
resource (State
is a custom resource created in my module)
This is what I have so far in my c++ module
TypedArray<State> states = TypedArray<State>();
in the .cpp:
void WorldStateManager::set_states(TypedArray<State> p_states) {
states = p_states;
}
TypedArray<State> WorldStateManager::get_states() const {
return states;
}
binding_methods:
ClassDB::bind_method(D_METHOD("set_states", "states"), &WorldStateManager::set_states);
ClassDB::bind_method("get_states", &WorldStateManager::get_states);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "states", PROPERTY_HINT_ARRAY_TYPE, "State"), "set_states", "get_states");
But in the inspector I get a normal Array
and it doesn't ask for the State
resource.