Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

colyseus-unity-sdk-0.14.15 ->18 Example Error. #209

Open
yty opened this issue Nov 13, 2022 · 2 comments
Open

colyseus-unity-sdk-0.14.15 ->18 Example Error. #209

yty opened this issue Nov 13, 2022 · 2 comments

Comments

@yty
Copy link

yty commented Nov 13, 2022

JsonSerializationException: Unable to deserialize instance of 'Colyseus.Schema.MapSchema`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' because there is no parameterless constructor is defined on type.
GameDevWare.Serialization.Metadata.TypeDescription.CreateInstance () (at Assets/Colyseus/Runtime/GameDevWare.Serialization/Metadata/TypeDescription.cs:134)
GameDevWare.Serialization.Serializers.ObjectSerializer.PopulateInstance (GameDevWare.Serialization.IndexedDictionary`2[KeyT,ValueT] container, System.Object instance) (at Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/ObjectSerializer.cs:221)
GameDevWare.Serialization.Serializers.ObjectSerializer.Deserialize (GameDevWare.Serialization.IJsonReader reader) (at Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/ObjectSerializer.cs:87)
GameDevWare.Serialization.JsonReaderExtentions.ReadValue (GameDevWare.Serialization.IJsonReader reader, System.Type valueType, System.Boolean nextToken) (at Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonReaderExtentions.cs:727)
GameDevWare.Serialization.Serializers.ObjectSerializer.DeserializeMembers (GameDevWare.Serialization.IJsonReader reader, GameDevWare.Serialization.IndexedDictionary`2[KeyT,ValueT] container, GameDevWare.Serialization.Serializers.ObjectSerializer& serializerOverride) (at Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/ObjectSerializer.cs:201)
Rethrow as SerializationException: Failed to read value for member 'attributes' of 'ExampleNetworkedUser' type.
More detailed information in inner exception.
GameDevWare.Serialization.Serializers.ObjectSerializer.DeserializeMembers (GameDevWare.Serialization.IJsonReader reader, GameDevWare.Serialization.IndexedDictionary`2[KeyT,ValueT] container, GameDevWare.Serialization.Serializers.ObjectSerializer& serializerOverride) (at Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/ObjectSerializer.cs:205)
GameDevWare.Serialization.Serializers.ObjectSerializer.Deserialize (GameDevWare.Serialization.IJsonReader reader) (at Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/ObjectSerializer.cs:76)
GameDevWare.Serialization.JsonReaderExtentions.ReadValue (GameDevWare.Serialization.IJsonReader reader, System.Type valueType, System.Boolean nextToken) (at Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonReaderExtentions.cs:727)
GameDevWare.Serialization.MsgPack.Deserialize (System.Type objectType, System.IO.Stream msgPackInput, GameDevWare.Serialization.SerializationContext context) (at Assets/Colyseus/Runtime/GameDevWare.Serialization/MsgPack.cs:98)
GameDevWare.Serialization.MsgPack.Deserialize (System.Type objectType, System.IO.Stream msgPackInput) (at Assets/Colyseus/Runtime/GameDevWare.Serialization/MsgPack.cs:84)
Colyseus.ColyseusRoom`1+<ParseMessage>d__37[T].MoveNext () (at Assets/Colyseus/Runtime/Scripts/Room/ColyseusRoom.cs:456)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) (at <695d1cc93cca45069c528c15c9fdd749>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <c62cc0ef748e4107b21e2999fa50d73a>:0)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()
JsonSerializationException: Unable to deserialize instance of 'ExamplePongMessage' because there is no parameterless constructor is defined on type.
GameDevWare.Serialization.Metadata.TypeDescription.CreateInstance () (at Assets/Colyseus/Runtime/GameDevWare.Serialization/Metadata/TypeDescription.cs:134)
GameDevWare.Serialization.Serializers.ObjectSerializer.PopulateInstance (GameDevWare.Serialization.IndexedDictionary`2[KeyT,ValueT] container, System.Object instance) (at Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/ObjectSerializer.cs:221)
GameDevWare.Serialization.Serializers.ObjectSerializer.Deserialize (GameDevWare.Serialization.IJsonReader reader) (at Assets/Colyseus/Runtime/GameDevWare.Serialization/Serializers/ObjectSerializer.cs:87)
GameDevWare.Serialization.JsonReaderExtentions.ReadValue (GameDevWare.Serialization.IJsonReader reader, System.Type valueType, System.Boolean nextToken) (at Assets/Colyseus/Runtime/GameDevWare.Serialization/JsonReaderExtentions.cs:727)
GameDevWare.Serialization.MsgPack.Deserialize (System.Type objectType, System.IO.Stream msgPackInput, GameDevWare.Serialization.SerializationContext context) (at Assets/Colyseus/Runtime/GameDevWare.Serialization/MsgPack.cs:98)
GameDevWare.Serialization.MsgPack.Deserialize (System.Type objectType, System.IO.Stream msgPackInput) (at Assets/Colyseus/Runtime/GameDevWare.Serialization/MsgPack.cs:84)
Colyseus.ColyseusRoom`1+<ParseMessage>d__37[T].MoveNext () (at Assets/Colyseus/Runtime/Scripts/Room/ColyseusRoom.cs:456)
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) (at <695d1cc93cca45069c528c15c9fdd749>:0)
UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <c62cc0ef748e4107b21e2999fa50d73a>:0)
UnityEngine.UnitySynchronizationContext:ExecuteTasks()

image

i tested colyseus-unity-sdk-0.14.15、colyseus-unity-sdk-0.14.16、colyseus-unity-sdk-0.14.17、colyseus-unity-sdk-0.14.18.
all this error.
but, colyseus-unity-sdk-0.14.7、olyseus-unity-sdk-0.14.10、olyseus-unity-sdk-0.14.12 has no errors.

uses unity3d.2020.3. 36f1 and unity2021.3.11f1

@lcd11001
Copy link

lcd11001 commented Jan 7, 2023

I have same issue when server broadcast a schema object to all clients

[Not working]

_room.OnMessage<Player>("customType", player =>
{
	OnPositionChanged?.Invoke(player.id, player);
});

Working

_room.OnMessage<Player>(player =>
{
	OnPositionChanged?.Invoke(player.id, player);
});

@Enemby
Copy link

Enemby commented Jan 25, 2023

I also have this issue but I'm unsure where it's happening. It only happens in one project under NDA I can't share. I've taken everything out, put it into another project, and no errors.

Working in 2020.1.7f1 but not in 2021.3.16f1. Using Colyseus 0.14.7.

I haven't changed almost anything in the example, I've just removed some features. Stepping through the room initialization process, it happens twice in the two frames of updating the username, and never again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants