ServerRpc
The server RPC allows logic to be ran on the server from a client - by default it will not require any ownership - so can be run by any player. This wont run on the client who called it unless RunLocally
is true
.
import { AirshipNetworkBehaviour, ServerRpc } from "@Easy/Core/Shared/Network";
export default class ExampleGlobalButton extends AirshipNetworkBehaviour {
// This will send a button press message to the server _only_
@ServerRpc()
public PressButton(player: Player, message: string) {
// Player argument necessary if not requiring ownership
print("The player", player, "pressed the button with their message", message);
}
}
Last updated