Skip to content

Server & Client RPCs combined #2448

@SpicedPigeon

Description

@SpicedPigeon

Is your feature request related to a problem? Please describe.
We want to call Client & Server Code with one RPC. The server should call the method directly and send an RPC to the client.
Currently this is not possible.

Describe the solution you'd like
Have a Method Attribute which is called "RPC" or "SharedRPC" which i can tag my methods with.
It then instead of only calling an Client RPC it also executes the function on the server.

Additional context
We have exposed functions which only foward their calls to an Unity Event. Our components now can listen to that event on the server and client. To do this i have to write something like this:

private void CalledSomewhereOnTheServer(){
      DoServerThings();
      onChangeUnityEvent?.Invoke(23);
      MyClientRpc(23);
}

[ClientRpc]
private void MyClientRpc(int i){
      onChangeUnityEvent?.Invoke(i);
}

Metadata

Metadata

Assignees

Labels

type:featureNew feature, request or improvement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions