Error CS0246: The type or namespace name 'RealtimeComponent<>' could not be found

So I am creating a system where players can change their name in game and it will change for other users as well. But I keep getting a namespace error on this line of code:

public class NameSync : RealtimeComponent<NameSyncModel>

Development Environment:
Windows 11
Unity Version: 2021.3.23f1
Normcore Version: 2.1

Deployment/Build platform:
Android (Quest 2)
Building for VR

Here my whole code:

using UnityEngine;

namespace Name
{
    public class NameSync : RealtimeComponent<NameSyncModel>
    {
        [SerializeField] private TextMeshPro _textMeshProText;

        protected override void OnRealtimeModelReplaced(NameSyncModel previousModel, NameSyncModel currentModel)
        {
            if(previousModel != null)
               previousModel.nameDidChange -= NameDidChange;

            if (currentModel != null)
            {
                if(currentModel.isFreshModel)
                    currentModel.name = _textMeshProText.text;

                UpdateName();

                currentModel.nameDidChange += NameDidChange;
            }
        }

        private void NameDidChange(NameSyncModel nameSyncModel, string value)
        {
            UpdateName();
        }

        private void UpdateName()
        {
            _textMeshProText.text = model.name;
        }

        public void SetText(string name)
        {
            model.name = name;
        }
    }
}

Will you post this and put all of your code in a code block? It should look something like this:

All of your code is in a box like this

Max

Your code looks correct, however the error you posted says “RealComponent” which should probably be “RealtimeComponent”

Max

So sorry that was just a typo. In my code it is RealtimeComponent. But still getting error.

I’m not sure then. I’d try importing one of the samples from the documentation site. If that shows the same error, then make sure you’re importing Normcore correctly. If it doesn’t show the same error, then compare your code to the sample code.

Max

Don’t worry I have fixed it I needed to have these at the top:

using UnityEngine;
using TMPro;
using Normal.Realtime;