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

"MonoBehaviour using the 'new' keyword. This is not allowed." #167

Open
zkMyst opened this issue Jun 26, 2021 · 0 comments
Open

"MonoBehaviour using the 'new' keyword. This is not allowed." #167

zkMyst opened this issue Jun 26, 2021 · 0 comments

Comments

@zkMyst
Copy link

zkMyst commented Jun 26, 2021

Hi!
I've been using the serializer with unity and firebase realtime database, but for some reason when trying to pull a json from a node, and I deserialize it:
var gameInfo = StringSerializationAPI.Deserialize(typeof(GameInfo), args.Snapshot.GetRawJsonValue()) as GameInfo;
I get the following error. Any idea what could cause this?
Thanks
You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all UnityEngine.MonoBehaviour:.ctor() GameInfo:.ctor() System.Activator:CreateInstance(Type, Boolean) FullSerializer.fsMetaType:CreateInstance() (at Assets/FullSerializer/Source/Reflection/fsMetaType.cs:354) FullSerializer.Internal.fsReflectedConverter:CreateInstance(fsData, Type) (at Assets/FullSerializer/Source/Converters/fsReflectedConverter.cs:92) FullSerializer.fsSerializer:InternalDeserialize_3_Inheritance(Type, fsData, Type, Object&, List1&) (at Assets/FullSerializer/Source/fsSerializer.cs:890)
FullSerializer.fsSerializer:InternalDeserialize_2_Version(Type, fsData, Type, Object&, List1&) (at Assets/FullSerializer/Source/fsSerializer.cs:835) FullSerializer.fsSerializer:InternalDeserialize_1_CycleReference(Type, fsData, Type, Object&, List1&) (at Assets/FullSerializer/Source/fsSerializer.cs:789)
FullSerializer.fsSerializer:TryDeserialize(fsData, Type, Type, Object&) (at Assets/FullSerializer/Source/fsSerializer.cs:757)
FullSerializer.fsSerializer:TryDeserialize(fsData, Type, Object&) (at Assets/FullSerializer/Source/fsSerializer.cs:731)
APIs.StringSerializationAPI:Deserialize(Type, String) (at Assets/Scripts/APIs/StringSerializationAPI.cs:29)
<>c__DisplayClass21_0:b__0(ValueChangedEventArgs) (at Assets/Scripts/NetworkManager.cs:117)
APIs.<>c__DisplayClass14_0:g__CurrentListener|0(Object, ValueChangedEventArgs) (at Assets/Scripts/APIs/DatabaseAPI.cs:202)
Firebase.Database.Internal.c__AnonStorey0:<>m__0() (at Z:/tmp/tmp.lovKbPiy9W/firebase/database/client/unity/proxy/InternalValueListener.cs:53)
Firebase.ExceptionAggregator:Wrap(Action) (at Z:/tmp/tmp.9ewH1DXgzz/firebase/app/client/unity/src/Platform/ExceptionAggregator.cs:112)
Firebase.Database.Internal.InternalValueListener:OnValueChangedHandler(Int32, IntPtr) (at Z:/tmp/tmp.lovKbPiy9W/firebase/database/client/unity/proxy/InternalValueListener.cs:45)
Firebase.AppUtilPINVOKE:PollCallbacks()
Firebase.AppUtil:PollCallbacks() (at Z:/tmp/tmp.BJ3HwuSQbT/firebase/app/client/unity/proxy/AppUtil.cs:32)
Firebase.Platform.FirebaseAppUtils:PollCallbacks() (at Z:/tmp/tmp.BJ3HwuSQbT/firebase/app/client/unity/proxy/FirebaseAppUtils.cs:33)
Firebase.Platform.FirebaseHandler:Update() (at Z:/tmp/tmp.9ewH1DXgzz/firebase/app/client/unity/src/Unity/FirebaseHandler.cs:208)
Firebase.Platform.FirebaseMonoBehaviour:Update() (at Z:/tmp/tmp.9ewH1DXgzz/firebase/app/client/unity/src/Unity/FirebaseMonoBehaviour.cs:45)
`

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

1 participant