what does this mean
Failed to set model on component (2:Cube (1) (XrParticleControlsSync)).
UnityEngine.Debug:LogError (object)
Normal.Realtime.RealtimeView:BindModelsToComponentMap (Normal.Realtime.ImmutableModelCollection,Normal.Realtime.RealtimeComponentMap)
Normal.Realtime.RealtimeView:Normal.Realtime.IConfigurableComponent.SetModel (Normal.Realtime.RealtimeModel)
Normal.Realtime.Realtime:ReplaceSceneViewModelWithFreshModel (Normal.Realtime.RealtimeView)
Normal.Realtime.Realtime:RegisterSceneRealtimeView (Normal.Realtime.RealtimeView)
Normal.Realtime.RealtimeView:Start ()
22 Replies
Hi @Lost Wizard Corp.. 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 is related to the RealtimeComponent's model in NormalVR's Normcore. It seems like the model for the component
Cube (1) (XrParticleControlsSync)
failed to be set. This could happen due to several reasons:
1. The model was instantiated with Unity’s Instantiate API (Instantiate()
or GameObject.Instantiate()
) instead of Normcore’s Realtime.Instantiate()
. If you're passing a prefab reference instead of a prefab string, then you're using the wrong one. Make sure to call Realtime.Instantiate(prefabName)
.
2. The prefab in Unity is corrupt, so the RealtimeComponent does not appear in the component list on the RealtimeView, and models are not created for those components.
3. A RealtimeView parent/child relationship is not saved correctly by Unity. In these cases, the RealtimeView child doesn't appear in the list of child views on the parent RealtimeView inspector.
4. You're using RealtimeComponent
(rather than RealtimeComponent<ModelType>
) and the model setter hasn’t been correctly implemented. This can be because the model setter didn’t save the value of the model or because it was not named model.
5. You're checking the model property inside of Awake()
(or, for scene RealtimeViews, inside of Start()
). To fix this:
- If using RealtimeComponent<ModelType>
, move the initialization logic inside of your OnRealtimeModelReplaced()
method.
- If using the legacy RealtimeComponent
class, move the initialization logic into your model setter.
You can find more details about these potential issues in the Normcore documentation (https://normcore.io/documentation/realtime/common-questions#why-would-a-realtimecomponents-model-remain-null).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1220362612794069042> kapa.ai is still learning and improving, please let us know how it did by reacting below
There’s usually another error printed with this one. What else is in the logs?
NullReferenceException: Object reference not set to an instance of an object
XrParticleControlsSync.InitializeModel (ParticleSystemModel model) (at Assets/scripts/XrParticleControlsSync.cs:308)
XrParticleControlsSync.OnRealtimeModelReplaced (ParticleSystemModel previousModel, ParticleSystemModel currentModel) (at Assets/scripts/XrParticleControlsSync.cs:52)
Normal.Realtime.RealtimeComponent`1[TModel].Normal.Realtime.IConfigurableComponent.SetModel (Normal.Realtime.RealtimeModel model) (at <1e560f460ca04c778a16074e4afc44a9>:0)
Normal.Realtime.RealtimeView.BindModelsToComponentMap (Normal.Realtime.ImmutableModelCollection models, Normal.Realtime.RealtimeComponentMap components) (at <1e560f460ca04c778a16074e4afc44a9>:0)
UnityEngine.Debug:LogException(Exception)
Normal.Realtime.RealtimeView:BindModelsToComponentMap(ImmutableModelCollection, RealtimeComponentMap)
Normal.Realtime.RealtimeView:Normal.Realtime.IConfigurableComponent.SetModel(RealtimeModel)
Normal.Realtime.Realtime:ReplaceSceneViewModelWithFreshModel(RealtimeView)
Normal.Realtime.Realtime:RegisterSceneRealtimeView(RealtimeView)
Normal.Realtime.RealtimeView:Start()
thanks for the reply , i cant tell whether the model is compiling properly , i feel like i had it at one point but seemed jittery on the remote client , i was redoing the system over this morning , a separate script loads the particle delegate and the sync script is attached to the particle itself requesting ownership for the local after its instantiated then when another player uses the knobs it will request ownership of the particle so they can change it and the particle and the knobs synced on both sides
what's on line 308?
308 model.position = _particleTransform.position; i think thats from the model not being set , when i check the particle transform it references the right particle and gets ownership
you can check if a model has been set yet with model != null
it gave me an error for that too it said i couldnt use != with model , i tried moving the check around too it always came down to != unable to compare model
model != null i mean
i can see the prefab delegate was causing problems too just getting the player to work the realtime player manager would load the player and then the delegate would also try to load but not see that it was loaded already ,
after removing the prefab delegate script and disabled trying to initialize setting the model initially i can get the particle system synced with controls ill have to come back to the delegate when loading a vr client and read up some more on the models structure
well now that i look i think the transform reference should be to the realtime transform the line 308
@Normcore Assistant Failed to set model on component (1:Panel (ParticleSystemSync1)).
UnityEngine.Debug:LogError (object)
Normal.Realtime.RealtimeView:BindModelsToComponentMap (Normal.Realtime.ImmutableModelCollection,Normal.Realtime.RealtimeComponentMap)
Normal.Realtime.RealtimeView:Normal.Realtime.IConfigurableComponent.SetModel (Normal.Realtime.RealtimeModel)
Normal.Realtime.Realtime:ReplaceSceneViewModelWithFreshModel (Normal.Realtime.RealtimeView)
Normal.Realtime.Realtime:DisconnectSceneViewsFromDatastore ()
Normal.Realtime.Realtime:SetRoom (Normal.Realtime.Room)
Normal.Realtime.Realtime:OnApplicationQuit ()
Let me check the knowledge base for you. One moment! :books:
----------------------
The error message you're seeing is related to the RealtimeComponent's model in NormalVR's Normcore. It seems like the model for the component
Panel (ParticleSystemSync1)
failed to be set. This could happen due to several reasons:
1. The model was instantiated with Unity’s Instantiate API (Instantiate()
or GameObject.Instantiate()
) instead of Normcore’s Realtime.Instantiate()
. If you're passing a prefab reference instead of a prefab string, then you're using the wrong one. Make sure to call Realtime.Instantiate(prefabName)
.
2. The prefab in Unity is corrupt, so the RealtimeComponent does not appear in the component list on the RealtimeView, and models are not created for those components.
3. A RealtimeView parent/child relationship is not saved correctly by Unity. In these cases, the RealtimeView child doesn't appear in the list of child views on the parent RealtimeView inspector.
4. You're using RealtimeComponent
(rather than RealtimeComponent<ModelType>
) and the model setter hasn’t been correctly implemented. This can be because the model setter didn’t save the value of the model or because it was not named model.
5. You're checking the model property inside of Awake()
(or, for scene RealtimeViews, inside of Start()
). To fix this:
- If using RealtimeComponent<ModelType>
, move the initialization logic inside of your OnRealtimeModelReplaced()
method.
- If using the legacy RealtimeComponent
class, move the initialization logic into your model setter.
You can find more details about these potential issues in the Normcore documentation (https://normcore.io/documentation/realtime/common-questions#why-would-a-realtimecomponents-model-remain-null).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1220362612794069042> kapa.ai is still learning and improving, please let us know how it did by reacting below
Are you quitting the app when you see this error?
no its when it first starts i have a base sync script that works with two values but when i add in the other variables to control it gives me that error and the base script works fine whether it starts automatically when the particle is created or i start it manually , when i go over it looks the same as the base and i am adding in the other variables,when it tries to read from the model it gives that error, ive tried removing and adding it with a new realtime view and clearing augmented code,i can keep the model with all the variables in it and use the base script just fine , the extra control script doesnt like it but its meant to interact with all those variables in the model
i thought maybe it was because of the realtime transform but is synced any way so just like the base script i removed the references for the transform , but it still gave the same error ,
@Normcore Assistant Failed to set model on component (1:Panel (ParticleSystemSync1)).
NullReferenceException: Object reference not set to an instance of an object
at ParticleSystemSync1.UpdateModelFromParticleSystem () [0x000cd] in <22e0edc31abc4408b1086ff54af63e54>:0
at ParticleSystemSync1.OnRealtimeModelReplaced (ParticleSystemModel previousModel, ParticleSystemModel currentModel) [0x000ec] in <22e0edc31abc4408b1086ff54af63e54>:0
at Normal.Realtime.RealtimeComponent`1[TModel].Normal.Realtime.IConfigurableComponent.SetModel (Normal.Realtime.RealtimeModel model) [0x00062] in <a227c266528c456ba9a195ecb812f7ce>:0
at Normal.Realtime.RealtimeView.BindModelsToComponentMap (Normal.Realtime.ImmutableModelCollection models, Normal.Realtime.RealtimeComponentMap components) [0x00081] in <a227c266528c456ba9a195ecb812f7ce>:0
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
Normal.Realtime.RealtimeView:BindModelsToComponentMap(ImmutableModelCollection, RealtimeComponentMap)
Normal.Realtime.RealtimeView:Normal.Realtime.IConfigurableComponent.SetModel(RealtimeModel)
Normal.Realtime.Realtime:ReplaceSceneViewModelWithFreshModel(RealtimeView)
Normal.Realtime.Realtime:RegisterSceneRealtimeView(RealtimeView)
Normal.Realtime.RealtimeView:Start()
Let me check the knowledge base for you. One moment! :books:
----------------------
The error message you're seeing is a
NullReferenceException
, which means that you're trying to access a member of an object that is null
. In this case, it seems to be happening in the UpdateModelFromParticleSystem()
method of your ParticleSystemSync1
class.
This error is often caused by not properly initializing an object before trying to use it. In the context of Normcore, it could be related to the timing of when the model is being accessed. For example, if you're trying to access the model in the Awake()
or Start()
methods, it might not be ready yet.
Here are some things you could check:
1. Make sure that the ParticleSystem
that you're trying to sync with the ParticleSystemSync1
component is not null and has been properly initialized before UpdateModelFromParticleSystem()
is called.
2. Ensure that the model is ready before you try to use it. The model is set by Realtime when you connect to the room. If you're checking the model property inside of Awake()
(or, for scene RealtimeViews, inside of Start()
), the model might not be ready yet. To fix this, move the initialization logic inside of your OnRealtimeModelReplaced()
method.
3. Check if the OnRealtimeModelReplaced()
method in your ParticleSystemSync1
class is correctly implemented. This method is called when the model is replaced, and it's where you should set up event listeners for your model and update your component's state to match the new model.
You can find more details about these potential issues in the Normcore documentation (https://normcore.io/documentation/realtime/common-questions#why-would-a-realtimecomponents-model-remain-null).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1220362612794069042> kapa.ai is still learning and improving, please let us know how it did by reacting below
I'd be curious to see the code of
OnRealtimeModelReplaced
and UpdateModelFromParticleSystem
of ParticleSystemSync