Can I call a Server RPC from within a blueprint interface event?

I am trying to have a laser light activate immediately on the owning client, and then have the new state secondarily sent to the server and replicated to all clients. However it seems when I call my RPC from within an interface function, it fails to run on the server.

image
Holding right mouse toggles laser visibility.


Here’s the inside of the event (sends an interface call to a child actor)


The interface function as it is received inside the child actor. (Turns a light to visible immediately on the client, and then attempts to pass the new boolean state to the server so it can be replicated to all the other clients).

image
The event to set the new state on the server.


And finally the RepNotify which handles the new light state on all the clients EXCEPT the local one (where it is already handled instantly.

Am I doing something wrong? Is this a bug? Why am I not able to call an RPC from within an interface? I have also tried calling a non-RPC event from within the interface, and then off that new event calling the RPC but still no avail. Any ideas on what I can do?

Edit: Seems that I can’t call ANY RPCs from within my laser light blueprint…


Begin play inside the laser light blueprint (a child actor of my player character)


The Server RPC being called (executes on server, RELIABLE)


Only prints “trying…” – i.e. the RPC won’t go through…

Does this have to do with ownership of the Child Actor Component or Child Actor? This blueprint is spawned via a Child Actor Component in my player character.

Jackson

ive heard recently that there was a new recent change to deal with cheating. and rpcs can only be called via objects owned by the the player controller (or that chain back to it).
i don’t have 1st hand experience with it. but could be your issue.

1 Like

I think you’re right. I set the owner of the Child Actor to be the Player Controller which is the parent of it, and it seems to have resolved the issue and the RPCs are calling again. Thanks.


Image: I bound an event to update the Owner of the Child Actor to whichever Controller owned the parent character.

image
Image: How I got access to the Received Controller Changed Delegate.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.