TransferOwnership not working
Options
Hi,
I'm trying to use transferownership when a new object has been instantiated over the network. I see the message:
TransferOwnership() view 1020 to: 1001 Time: 609
and then:
Ev OwnershipTransfer. ViewID 1020 to: 1001 Time: 890
but if I select the object, the owner is still scene, instead of player 1.
I call this code immediately after the object is spawned using photonnetwork.instantiate and it is run after both players have been created. This is in a gameplay scene that is loaded once both players join the room in the lobby scene, so I assume that both players are already in the room by the time this code runs.
-JJ
I'm trying to use transferownership when a new object has been instantiated over the network. I see the message:
TransferOwnership() view 1020 to: 1001 Time: 609
and then:
Ev OwnershipTransfer. ViewID 1020 to: 1001 Time: 890
but if I select the object, the owner is still scene, instead of player 1.
I call this code immediately after the object is spawned using photonnetwork.instantiate and it is run after both players have been created. This is in a gameplay scene that is loaded once both players join the room in the lobby scene, so I assume that both players are already in the room by the time this code runs.
-JJ
0
Comments
-
Hi,
can you try the owner demo in pun and check if this happens there too?
It could be that calling too soon after instantiation means the transfer happens before the instantiation call somehow and is overwritten.
Bye,
Jean0 -
I tried putting in a delay (0.5 seconds) to transfer ownership after the object is spawned and that still didn't work.0
-
Also, in the owner demo (DemoChangeOwner-Scene?) the ownership transfer happens when an object is clicked not when it is created. That works just fine, ie: in my game if a player picks up an object they request ownership and it transfers just fine for them. It doesn't work when the object is spawned or even with a delay after that time. But the ev message comes through correctly as per my post above. So how can we assign ownership of an object to a player if they haven't requested it?0
-
Ok, I think I figured it out. I was using the viewID of the player not the actorID. Didn't realize those were 2 different things.0
-
Hi,
good, I am glad you figured it out.
viewId is for each individual networked object, and there can be several of them owned by the same actorId.
Bye,
Jean0 -
what do you mean by " I was using the viewID of the player not the actorID" i am having the same problemcapitalj said:Ok, I think I figured it out. I was using the viewID of the player not the actorID. Didn't realize those were 2 different things.
0