colyseus / colyseus-haxe

⚔ Colyseus Multiplayer SDK for Haxe
https://docs.colyseus.io/getting-started/haxe-client/
MIT License
75 stars 16 forks source link

ArraySchema does not trigger state change on client when assigned to empty value #31

Closed serjek closed 4 years ago

serjek commented 4 years ago
var ArraySchema = require("@colyseus/schema").ArraySchema;
//decorating like this:
(require("@colyseus/schema").type(["number"]))(MySchema.prototype,"turns");
//in MySchema:
this.turns = new ArraySchema(); //no update on client
//... some action
this.turns.push(10); //have update on client
//... some more action, game over, now we need to reset
this.turns = new ArraySchema(); //no update on client again so there is a desync with server
serjek commented 4 years ago

It happens only upon ArraySchema is first created. It does not report change unlike the MapSchema, so client needs to be aware of that behaviour.