The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Difference between Actor and User

ThinkTwice
2020-01-13 18:31:55

Hello guys,

Can someone explain to me the difference between and userId and an actorId. I was thinking all the time they are the same thing until I just realized they are two different things.

1- What is the difference between userId and an actorId? I couldn't find an explanation on the docs.
2 - Since we differentiate between user and actor, is it possible to have more than one actor?
3 - Am I right to assume that I will only be able to set/change the actor id only while inside of a lobby or room? and that the user id would be always possible to change?

Comments

JohnTube
2020-01-15 10:15:37

Hi @ThinkTwice,

Thank you for choosing Photon!

  1. UserId is string, ActorId or, proper name, ActorNumber is an integer. UserId is valid for a whole 'session' to Photon Servers, starting from the initial connection to the first Photon Server until disconnected. ActorNumber is valid only inside a room and per room. Inside the room you could identify the user by its actor number or if some conditions are met, you could use the UserId. Outside rooms, a user is identified by its UserId (which is the same for 'FriendId', etc.).
  2. A user becomes an actor when joined to the room. The same user can connect to Photon using multiple clients and same UserId. However, we now, by default, no longer allow two actors with the same UserId in the same room. Besides, rejoining a room is now based on UserId (as opposed to ActorNumber before). The rejoining actor gets to keep its originally claimed actor number.
  3. Once connected you can't change the UserId. The UserId is set in the authentication during the initial connection to the first Photon server. The actor number can never be set or changed by the client, the server sets it.

ThinkTwice
2020-01-15 14:54:14

Hei @JohnTube

Thank you for the detailed information. It helped me a lot to understand the logic behind the actor and user workings.

Back to top