Can an actor's RPC function be called from another class that isn't also an AActor?
EDIT: I've answered my own question here. I am able to call ServerRPC from a non-AActor class. The confusion for me stemmed from the assumption that RPC calls were executed over the network immediately, when in fact, they will only be executed with the next call to EngineTick().
I'm trying to create a network communication channel between a client and a server. To do this, I use the Server-side PlayerController and its replicated counterpart on the client, and have them communicate with each other via Server/Client RPCs.
I can get this to work in one situation, but not in another. The key difference seems to be that, in the working case both server and client RPC calls are made by AActors. Specifically, the ClientRPC is called by the server's GameMode class (which is an AActor), and the ServerRPC is called by the PlayerController (also an AActor), in its Tick() function.
In the broken case, I am attempting to call the ServerRPC from GuardedMain(), inside Launch.cpp. I have access to the replicated PlayerController via a global pointer, and I use that to call the ServerRPC. In my tests the corresponding ServerRPC_Implementation() function is never called, when using this setup.
Given this, my question is: Is it even possible to call the ServerRPC from Launch.cpp? And if so, are there any big pitfalls that I might be overlooking that's preventing this from working for me?
TIA for any advice!
Follow this question
Once you sign in you will be able to subscribe for any updates here