GitHub | Documentation | Discord (chat) | Become a Patron

Unity OnMessage Handler Error



  • OnMessage Code below Down

    	void OnMessage (object sender, MessageEventArgs e)
    	{
    		Debug.Log("OnAddMessages | " +  "|"+ChatUtils.ValueToString(e.message));
    		var message = (IndexedDictionary<string, object>) e.message;
    		Debug.Log(e.message);
    
    	}
    

    and I send

    room.Send("111");

    but after I get response

    InvalidCastException: Specified cast is not valid.
    ColyseusClient.OnMessage (System.Object sender, Colyseus.MessageEventArgs e) (at Assets/PluginsColesus/ColyseusClient.cs:99)
    Colyseus.Room.ParseMessage (System.Byte[] recv) (at Assets/PluginsColesus/Colyseus/Room.cs:195)
    Colyseus.Room.Recv () (at Assets/PluginsColesus/Colyseus/Room.cs:83)
    Colyseus.Client.Recv () (at Assets/PluginsColesus/Colyseus/Client.cs:89)
    ColyseusClient+<Start>d__7.MoveNext () (at Assets/PluginsColesus/ColyseusClient.cs:58)
    UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)

    Why dont i Get sending data "111".
    Plese check this
    My Unity 2017.3.1f
    Colyseus Latest project .