The problem with that snippet is that the owner is a nullptr for some calls. So, while in blueprint editor, “MyFunction()” would not be called. What I want is some way to call MyFunction that needs a reference to the owner actor. I dont know if this is directly possible through some UActorComponent event, like “OnComponentCreated()” or if I have to set a specific creation method, or use SCS. I have spent some time with this problem without any succes, the best I was able to get was to run “MyFunction” when the owning actor gets spawned on the world.
Thanks a lot, i have small addition to your solution.
GetAllNodes() returns only ActorComponents created in Blueprint here how to get ActorComponents created in C++ also, via BlueprintGeneratedClass->GetDefaultObjectSubobjects()