RPC doesn't work on repicated UObject
I've set up my UObject derived class properly (like recomended here). And property replication works good, BUT I can't call RPC on this object. On server side I've tried to call method marked as
asked Jun 14 '16 at 11:56 AM in C++ Programming
I am researching this topic as well and also implemented your referenced link. I've looked right into the engine code and interestingly enough "CallRemoteFunction" of UObject simply returns false, while Actor and ActorComponent are implementing the function like this:
First of all, I do not really know how RPCs are exactly created from the written code. But since UObject is not able to do RPCs, while Actor and ActorComponents can and these two inherit from UObject, there must be some function(s) which override(s) something from UObject to allow the known behaviour of RPCs.
As you can see there is a need of an Owner and further along if you want to differ your Role between ROLE_Authority or ROLE_... you will realize that UObject does not have a role. Problem is UObject does neither contain Owner nor a Role.
answered Jun 24 '16 at 10:23 PM
So, I also need to call RPC events and found solution..
As smara mentioned above, CallRemoteFunction() returns false, but if you copy logic from AActor Component, you should get True. But there is another problem.. When function calls, it reaches GetFunctionCallspace(), wich returns Local by default from UObject. You have to override it as well..
NOTE, that your Outer must be an Actor, that replicates this object! If you need to call Server functions (from client), Outer should be you an Actor, wich is owned by your player controller.
Erm since the "answer" is only an answer to your question as to why it doesn´t work, assuming that you would actually like to know how you can make it work and have a proper visual demonstration of what works and what doesn´t work as a cheatsheet from the actual documentation, see here: http://prntscr.com/bz6o5l
So to sum up - if you want this to work, you don´t use NetMulticast - but use Server.
answered Jul 29 '16 at 07:03 PM
if i call the rpc function of uobject in playercontroller in server , the uobject alse cant netmulitcast to other clients? why ?
answered Oct 13 '16 at 09:58 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here