NeuroGoblinN
Normal2y ago
9 replies
NeuroGoblin

How to make a custom model using a type other than Color?

Hey guys! I have been following the Synchronising Custom Data guide (https://normcore.io/documentation/realtime/synchronizing-custom-data) and managed to get the ColorSync working successfully.

I now want to change this to allow for strings to be sent to all clients, to update a TextMeshPro component. I replicated all the steps for the Color guide, but the delegate events such as textDidChange are not being generated from the model (see pic).

This is my Model file: using System.Collections; using System.Collections.Generic; using UnityEngine; using Normal.Realtime; using Normal.Realtime.Serialization; [RealtimeModel] public partial class TextSyncModel { [RealtimeProperty(1, true, true)] private string _messageText; }

For some reason, the code is not autogenerating like the ColorSyncModel did, and there is no option to manually re-generate. I am using Unity 2022.3.11. The only thing I did differently is I copy/pasted all the color scripts (colorsync, colorsynctest, colorsyncmodel) and changed the code to reflect a string instead of colors. The model has no compliation errors, and I tried deleting it and re-writing it from scratch.

Any help would be greatly appreciated!
image.png
In this guide, I’m going to walk you through how to synchronize custom data in your Unity application using custom realtime components.
Synchronizing Custom Data | Normcore Documenation
Solution
the name of the didChange event is prefixed by the property name, in your case messageTextDidChange
Was this page helpful?