Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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!

Product Version: Not Selected
more ▼

asked Dec 15 '14 at 09:57 PM in C++ Programming

avatar image

13 2 3 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question