This is what I’m currently doing for querying components that I need at runtime.
but honestly I don’t want to repeat that for loop for each query, Don’t know if it can be approached with a Parametric Type function to do the one in the comment. Or expose this as @editable and set in the Editor directly.
using { /Verse.org/SceneGraph }
my_interface := interface:
my_component_with_interface := class<final_super>(component, my_interface):
my_component := class<final_super>(component):
var MyInterface : ?my_interface = false
OnBeginSimulation<override>():void=
(super:)OnBeginSimulation()
for(Component : Entity.GetComponents(), not MyInterface?, NewValue := my_interface[Component]):
set MyInterface = option { NewValue }
#What I would like to do
#if(NewValue := Entity.GetComponentWithInterface[my_interface]):
# set MyInterface = option { NewValue }