What is the ActorNumber/UserID naming scheme and clashing numbers?
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
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).
What is the ActorNumber/UserID naming scheme and clashing numbers?
Chr0my
2020-07-19 02:07:15
Hi!
I have a 10 player lobby. I want to assign each player something, but I need to know the actornumber scheme. Is it just 0, 1, 2, 3, etc? or?
or
How can I make all the actor numbers +1 from 0?
also
Can there be 2 of the same actor numbers? if so any way to get a new number and how can you detect a clash?
thanks!
Comments
Hi @Chr0my,
You probably need player number or player index instead of actor number.
Read more here: https://forum.photonengine.com/discussion/comment/46285/#Comment_46285
and here
https://forum.photonengine.com/discussion/comment/51921/#Comment_51921
@JohnTube
So for the player index - is it guaranteed that it will be +1 and that host is 1? i want to make a switch function.
There is no host in Photon.
There is master client.
Master client can change.
If you mean room creator, initial master client, then yes if it's still in the room it will always have actor number 1 and player index (0 or 1) not sure what is the initial value used.
In any case, whether you use actor number or else, it also depends on your game, if it allows drops/disconnects and rejoins or if it allows late joins, etc.
Oh thanks! Do you know where i can find out if it is 0 or 1 because I'm making a switch case?
I checked PlayerNumbering code, I think it starts with 0.
Last question:
Will this work?
switch (PhotonNetwork.LocalPlayer.GetPlayerNumber())
{
case '0':
Debug.Log("0");
photonView.RPC("RPC_NickName", RpcTarget.All, nickName);
break;
case '1':
Debug.Log("1");
photonView.RPC("RPC_NickName1", RpcTarget.All, nickName1);
break;
//ect players
}
If not could you show me just a quick example of what would?
@JohnTube
^ (sorry i cant test the code, just wanted to know theoretically if it would work)
Anyway thank you so much for all the help!!!
Back to top