GitHub Documentation Patreon donate button

TriggerAllFillChanges InvalidCastException



  • Hi,

    I have a class with my Client and Room variables in Unity.
    I was using just one Scene in Unity, and the game was working fine.
    When the game starts, I am using ColyseusManager.room.State.TriggerAll(); to receive the changes from the server.

    But then I decided to make two scenes for better organization of my game:

    • The Scene 1 have a button to the game leader send a command to the server to start the game.
    • The Scene 2 is the game itself.
      Both of these scenes use the static variables (room and client) from my singleton class.

    The problem is that, after starting another scene, the method TriggerAll() throws this exception:
    0_1610414513285_colyseus_er.png

    Thanks for any help!



  • I am still investigating the issue. It seems that I cannot change scenes after connected to a room, if I change the TriggerAll() throws the error.

    Does anyone have any ideas?



  • Can't make it work... Well, for now I will be using a server side "hack" to trigger the state change at the start of a match.
    Oh, and I also add this to the Schema.cs file to the error go away:
    0_1610493539520_tostringcast.png


 

© 2020 Endel Dreyer