How to do this,without playercontroller possess this actor,thank you.
I Spawn an actor in server, but in client,it's Role is simulatedproxy, How to let client's Role become autonomousproxy?
I think with AActor::SetOwner. I am not sure.
It can’t work.
There is a simple function for that:
Note: this gets automatically called when you possess a Pawn.
can’t work too.This can change the remoterole in server,but the role of the client still is simulatedproxy
Yes, call SetAutonomousProxy on the server.
UPROPERTY(Replicated, transient) TEnumAsByte<enum ENetRole> RemoteRole;
RemoteRole is replicated and will be replicated to all clients and therefore just work.
For more stuff on that, you can see how
APawn::PossessedBy(AController* NewController) is implemented.