Just starting out with the Javascript SDK in Playcanvas. I would like to use room properties to communicate damage/pickups for scene objects so that clients joining later get all the same info.
If I join a room with two players in separate browsers, when I test setting custom properties on the current room with this:
this.photon.currentRoom.setCustomProperty(id, amount);
(id is the predetermined scene object's id, amount is how much damage is being applied)
Both players receive a response from this:
this.currentRoom.onPropertiesChange = function(change, byClient) {
console.log("onPropertiesChange:", change, byClient);
};
However, in onPropertiesChange the change variable is populated with the correct info on the player that did the damage, while on the other player the change object is empty. I also tried debugging currentRoom._customProperties and it had the same problem (data populated on player that did it, blank for other player).
Is this expected behavior? Should I be using some other method?
If I join a room with two players in separate browsers, when I test setting custom properties on the current room with this:
this.photon.currentRoom.setCustomProperty(id, amount);
(id is the predetermined scene object's id, amount is how much damage is being applied)
Both players receive a response from this:
this.currentRoom.onPropertiesChange = function(change, byClient) {
console.log("onPropertiesChange:", change, byClient);
};
However, in onPropertiesChange the change variable is populated with the correct info on the player that did the damage, while on the other player the change object is empty. I also tried debugging currentRoom._customProperties and it had the same problem (data populated on player that did it, blank for other player).
Is this expected behavior? Should I be using some other method?