MasterOX 水
MasterOX 水7mo ago

error when syncing custom int

Failed to set model on component (1:score2 (score2)).
4 Replies
kapa.ai
kapa.ai7mo ago
Hi @MasterOX 水. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- The error message you're seeing suggests that there might be an issue with the way you're trying to synchronize your custom integer value in your score2 component. Here are a few things you might want to check: 1. RealtimeComponent Subclass: Make sure that your score2 component is a subclass of RealtimeComponent. If you added your custom component to a game object before it was converted to a RealtimeComponent subclass, it might not sync properly. If a RealtimeView has not been created for you automatically, try removing the component and re-adding it to your game object. This will tell Unity to automatically create a RealtimeView and add your RealtimeComponent subclass to its component list. source (https://normcore.io/documentation/realtime/synchronizing-custom-data#my-custom-realtimecomponent-isnt-syncing-and-onrealtimemodelreplaced-doesnt-get-called) 2. Serialization: Ensure that the data type you're trying to sync is serializable. Only primitives (int, float, Vector3, string, etc.) can be serialized. If you need to sync a specific kind of object, you should create a field for each property on the object that you’d like to sync. source (https://normcore.io/documentation/room/common-questions#when-i-try-to-sync-a-specific-object-to-the-datastore-i-get-an-error-that-says-it-cannot-be-serialized-whats-the-issue) 3. PropertyID: Make sure that the property ID for your integer value is unique to the model. If you need to change the type of this property, you'll want to create a new property with a new property ID and deprecate the existing one. This will ensure that newer versions of your application can still communicate with older versions. source (https://normcore.io/documentation/realtime/synchronizing-custom-data#propertyid) If you're still having trouble, you might want to review the guide on how to synchronize custom data in your Unity application using custom realtime components. source (https://normcore.io/documentation/realtime/synchronizing-custom-data) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai7mo ago
<@758040514678489279> kapa.ai is still learning and improving, please let us know how it did by reacting below
Mechabit
Mechabit7mo ago
make sure the room is in the ready state before accessing any models
MasterOX 水
MasterOX 水OP7mo ago
thanks