Types of RPC

Metadata Specifier Description
Client 액터를 소유한 클라이언트에서 실행
Server 서버에서 실행, 이 액터를 소유한 클라에서만 호출해야함.
Remote 연결된 remote 측 (서버 또는 클라이언트) 에서 실행. RPC는 클라이언트가 소유한 액터에서만 호출할 수 있음.
NetMulticast 서버, 액터가 관련있는 모든 연결된 클라이언트에서 실행. (서버에서 호출되도록 설계되었지만, 클라에서도 호출할 수 있음. 클라에서 호출된 NetMulticast RPC 는 로컬에서만 실행)

RPC 구조

DerivedActor.h
UFUNCTION(Client)
void ClientRPC();

UFUNCTION(Server)
void ServerRPC();

UFUNCTION(NetMulticast)
void MulticastRPC();

#include "DerivedActor.h"
void ClientRPC_Implementation()
{	
}

얘도 bReplicates = true 해야함.

Unicast Versus Multicast

RPC invoked from the server

Actor ownership Not replicated NetMulticast Server Client
Client-owned actor Runs on server Runs on server and all clients Runs on server Runs on actor's owning client
Server-owned actor Runs on server Runs on server and all clients Runs on server Runs on server
Unowned actor Runs on server Runs on server and all clients Runs on server Runs on server

RPC invoked from a client

Actor ownership Not replicated NetMulticast Server Client
Owned by invoking client Runs on invoking client Runs on invoking client Runs on server Runs on invoking client
Owned by a different client Runs on invoking client Runs on invoking client Dropped Runs on invoking client
Server-owned actor Runs on invoking client Runs on invoking client Dropped Runs on invoking client
Unowned actor Runs on invoking client Runs on invoking client Dropped Runs on invoking client