Why Pun demo dont use Service funcion
Options
coco
✭
hi all, We Alwalys Use Service function to connect the Host.
like this:
THANK YOU!
like this:
void Update() { if(peer!=null) peer.Service(); }But Where is the "service" function in Pun demo.
THANK YOU!
0
Comments
-
PUN's PhotonHandler is more advanced and can be customized.
In any case both ways use the same thing internally: sending outgoing messages and processing incoming ones.
We usually recommend calling Service 10 to 20 times a second. Doing so in Update will result in a call per frame which may be 30 or 60 or more per second which can eat more CPU or drain more battery on mobile.
More info about Service:-
Service()
internally callsDispatchIncomingCommands()
until it returns false to dispatch all received incoming messages into your game logic. - Calling
Service()
also processesSendOutgoingCommands
which actually sends operations that your client called since the lastSendOutgoingCommands
. - Finally
Service()
triggers the callbacksOnEvent
,OnOperationResponse
, etc.
0 -