instance:setName(name) not working

I am trying to set Actor Name after room joined.

I am calling setName(name) method in
instance:onJoinRoom() function.

There is no error in log when i call instance:setName(name) method.

When i call function instance:myRoomActors() and get list of actors with local actor too.
And i try to print actor name property but there is NULL string for the name.
function client:onJoinRoom(createdByMe)
   
    local aa = client:myRoomActors()
    local myActor = client:myActor()
    local t = os.time()
    myActor.name = "p_"..string.sub(tostring(t),7,10)
    myActor:setName(myActor.name)
   
end
i try to get list of room actors
local function printRoomActorList()
   local actrList = client:myRoomActors()
    for i=1,#actrList do
       for k,v in pairs(actrList[i]) do
           print(k,v)
       end
    end
end
I got actors table , but there is no name for the actor, i can get actorNr but no name there..

What's the issue there ?
can you help me please ?

Thank you.
Bhavin :)

Comments

  • Hi,

    Changing player name after client has joined a room is not supported. Set name before connecting to the cloud or at least before joining a room.
    When iterating actors, name should be in actrList[i].name property.
    Look at demo-particle for actor name and myRoomActors() usage sample.
  • Thanks.

    Yes, perfect solution.
    setPlayer name before join any room.

    Thank you.
    Bhavin :)
Sign In or Register to comment.