RonJames
RonJames5w ago

RealtimeView inside a scene

So I'm having this issue where I have a series of prefabs inside my scene which all have realtime models. They are multiple instances of the same prefab but are not instatiated. Rather hand placed and enabled after start in my game scene. I seem to be getting the error RealtimeView model is null. Was this view instantiated with GameObject.Instantiate instead of Realtime.Instantiate? Make sure you're passing a prefab name and not a prefab reference to avoid accidentally calling GameObject.Instantiate(). when I enable them in the scene. I have a realtime component setup that does connect to the server.
6 Replies
kapa.ai
kapa.ai5w ago
Hi @RonJames. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Short answer: scene objects with RealtimeView are valid, but they only get their models after the scene’s Realtime has registered them and the room is connected. If you enable them too early (or before RealtimeView registers), you’ll see “model is null.” Checklist to fix: - Ensure these are true “scene views” (placed in the scene, not instantiated at runtime). Scene views don’t use Realtime.Instantiate and will be initialized by Realtime after Start and upon connection. [RealtimeComponent; RealtimeView (Common Qs)] - Don’t touch the model/ownership in Awake (or Start for scene views). For scene objects, wait until realtime.connected == true or subscribe to Realtime.didConnectToRoom before accessing RealtimeView/model. For component initialization, use OnRealtimeModelReplaced to react when the model is assigned. [RealtimeView (Common Qs); RealtimeComponent] - If you’re enabling these objects after Start, make sure RealtimeView wasn’t disabled at Start (disabled scene RealtimeViews won’t register and won’t get a model). Don’t disable RealtimeView; instead, disable your own renderers/scripts and keep the RealtimeView enabled so it can register. [RealtimeView (Common Qs)] - Verify the RealtimeView shows your RealtimeComponents in its Components list in the Inspector. If the prefab got corrupted (or child view relationships broke), the model won’t be created. [RealtimeComponents (Common Qs); RealtimeView page] - For prefabs you do want to spawn at runtime, you must use Realtime.Instantiate("PrefabName", …) and keep the prefab in a Resources folder or use a custom load delegate (e.g., Addressables). Passing a prefab reference to Unity’s Instantiate will cause the exact error you’re seeing. [Realtime API; Realtime reference] Practical pattern: - In your scene RealtimeComponents, move model-dependent setup into OnRealtimeModelReplaced, and guard against null until it’s called. - When enabling a hand-placed object after Start, ensure Realtime.connected is true, or delay enabling until didConnectToRoom fires. [RealtimeComponent; RealtimeView (Common Qs)] If you follow the above and still get “model is null,” double-check: - The RealtimeView wasn’t disabled at Start. - The RealtimeView has the correct Realtime instance assigned (or left blank if there’s only one instance). [Advanced settings] - The Components/Children lists in the RealtimeView inspector look correct (no missing component IDs/child views). [RealtimeView page] ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5w ago
<@378869779668140042> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
RonJames
RonJamesOP5w ago
@kapa.ai Room "TCI1NY": [InternalServerError] Failed to handle connect to room request: Matcher attempting to query clusters, but ClusterManager is not connected to all clusters. UnityEngine.Debug:LogError (object) Normal.Realtime.Room:RaiseConnectionError (Normal.Realtime.DisconnectEvent) Normal.Realtime.Room/<ConnectToServer_Coroutine>d__114:MoveNext () UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr) can you explain this error?
kapa.ai
kapa.ai5w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- The error message:
[InternalServerError] Failed to handle connect to room request: Matcher attempting to query clusters, but ClusterManager is not connected to all clusters.
indicates that the Normcore matcher service is unable to connect to all of the clusters it is configured to manage. In Normcore's cloud architecture, the matcher is responsible for routing room connection requests to the appropriate cluster. If the matcher cannot communicate with all clusters (for example, due to network issues, misconfiguration, or a cluster being down), it cannot fulfill room connection requests, resulting in this internal server error [Cloud Architecture]. This is a backend infrastructure issue, not a client-side or Unity code problem. The error means the matcher service is not fully connected to all clusters, so it cannot create or join rooms as requested. What you can do: - If you are managing your own Normcore Private installation, check that all clusters are running and that the matcher service is correctly configured to communicate with them [Google Cloud Installation]. - If you are using Normcore Cloud (hosted by NormalVR), this is likely a temporary backend issue and may require contacting NormalVR support. There is no indication in the knowledge sources of a client-side fix for this error; it must be resolved at the server or infrastructure level. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5w ago
<@378869779668140042> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
maxweisel
maxweisel4w ago
Do you still have this error when successfully connecting? and are you on the latest version of Normcore? also when are you enabling them? in general, RealtimeViews in a scene are going to register with Realtime in Start() in order to be connected to the datastore. are you attempting to access models immediately after? you may need to wait a frame for models to be supplied by Realtime in the case where you’re enabling them at runtime.

Did you find this page helpful?