How to have global accessor such as GetPlayerPawn for specific custom actor(s)?

Hi there,

I am writing a small udp networking class that exports data and controls part of the world. To do this I have an actor (ANetworkCommunicator) that handles Udp sockets, sending, receiving, etc… and also needs ticking.

Now i’d like to be able to reference this actor without the need of creating a scene-linked member, member that searches for a given tag or argument everywhere I need.
What i’d really like is to be able to do like the GetPlayerPawn / GetPlayerController / etc…

Is it possible to automatically spawn and reference or register the scene instance of that actor and then have an accessor such as GetRegisteredActor([Simple arguments such as UWorld*]) ?

I tried to use the GameInstance but If I have a Network-like member, there is no tick function, and I might want to have a different Networking Actor depending of the level.

Thansk !

The solution I decided to take was to change the GameMode.

While overriding the StartPlay, the Super method will call all the BeginPlay event of all actors in the scene.
Thus by taking in consideration that any AActor should be able to access the “Global” instance in the BeginPlay, I need to Find the reference / Spawn An instance Before calling Super.
Then I keep a Weak Reference to the found / created instance and expose it through a Getter.

Conceptually it gives something like this:
GetGameMode -> Get [Global Instance of choice],
which could be simplified in a custom function :
GetGlobalInstance() { GetGameMode -> Get [Global Instance of choice] }.

It doesn’t feel like the best solution but it fulfuls my needs !