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
kapa.ai
kapa.ai5mo ago
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: ----------------------
kapa.ai
kapa.ai5mo ago
<@1220362612794069042> kapa.ai is still learning and improving, please let us know how it did by reacting below
maxweisel
maxweisel5mo ago
There’s usually another error printed with this one. What else is in the logs?
Lost Wizard Corp.
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
Mechabit
Mechabit5mo ago
what's on line 308?
Lost Wizard Corp.
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
Mechabit
Mechabit5mo ago
you can check if a model has been set yet with model != null
Lost Wizard Corp.
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 ()
kapa.ai
kapa.ai5mo ago
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: ----------------------
kapa.ai
kapa.ai5mo ago
<@1220362612794069042> kapa.ai is still learning and improving, please let us know how it did by reacting below
Mechabit
Mechabit5mo ago
Are you quitting the app when you see this error?
Lost Wizard Corp.
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()
kapa.ai
kapa.ai5mo ago
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: ----------------------
kapa.ai
kapa.ai5mo ago
<@1220362612794069042> kapa.ai is still learning and improving, please let us know how it did by reacting below
NormalMark
NormalMark5mo ago
I'd be curious to see the code of OnRealtimeModelReplaced and UpdateModelFromParticleSystem of ParticleSystemSync
Lost Wizard Corp.
protected override void OnRealtimeModelReplaced(ParticleSystemModel previousModel, ParticleSystemModel currentModel) { if (previousModel != null) { previousModel.startSpeedDidChange -= OnStartSpeedChanged; previousModel.lifetimeDidChange -= OnLifetimeChanged; previousModel.colorGradientIndexDidChange -= OnColorGradientChanged; previousModel.colorOverLifetimeDidChange -= OnColorOverLifetimeChanged; previousModel.speedOverLifetimeDidChange -= OnSpeedOverLifetimeChanged; previousModel.velocityOrbitalXDidChange -= OnVelocityOrbitalXChanged; previousModel.velocityOrbitalYDidChange -= OnVelocityOrbitalYChanged; previousModel.velocityOrbitalZDidChange -= OnVelocityOrbitalZChanged; previousModel.toggleEffectDidChange -= OnToggleEffectChanged; previousModel.positionDidChange -= OnPositionChanged; previousModel.rotationDidChange -= OnRotationChanged; previousModel.scaleDidChange -= OnScaleChanged; } if (currentModel != null) { if (currentModel.isFreshModel) UpdateModelFromParticleSystem(); currentModel.startSpeedDidChange += OnStartSpeedChanged; currentModel.lifetimeDidChange += OnLifetimeChanged; currentModel.colorGradientIndexDidChange += OnColorGradientChanged; currentModel.colorOverLifetimeDidChange += OnColorOverLifetimeChanged; currentModel.speedOverLifetimeDidChange += OnSpeedOverLifetimeChanged; currentModel.velocityOrbitalXDidChange += OnVelocityOrbitalXChanged; currentModel.velocityOrbitalYDidChange += OnVelocityOrbitalYChanged; currentModel.velocityOrbitalZDidChange += OnVelocityOrbitalZChanged; currentModel.toggleEffectDidChange += OnToggleEffectChanged; currentModel.positionDidChange += OnPositionChanged; currentModel.rotationDidChange += OnRotationChanged; currentModel.scaleDidChange += OnScaleChanged; } } private void UpdateModelFromParticleSystem() { _isUpdatingModel = true; model.startSpeed = _mainModule.startSpeed.constant; model.lifetime = _mainModule.startLifetime.constant; model.colorOverLifetime = colorOverLifetimeKnob.value; model.speedOverLifetime = speedOverLifetimeKnob.value; model.velocityOrbitalX = velocityOrbitalXKnob.value; model.velocityOrbitalY = velocityOrbitalYKnob.value; model.velocityOrbitalZ = velocityOrbitalZKnob.value; model.colorGradientIndex = colorGradientDropdown.value; model.toggleEffect = particleSystem.isPlaying; //model.position = particleSystem.transform.localPosition; //model.rotation = particleSystem.transform.localRotation; //model.scale = particleSystem.transform.localScale; _isUpdatingModel = false; } the model using Normal.Realtime; using Normal.Realtime.Serialization; using UnityEngine; [RealtimeModel] public partial class ParticleSystemModel { [RealtimeProperty(1, true, true)] private float _startSpeed; [RealtimeProperty(2, true, true)] private float _lifetime; [RealtimeProperty(3, true, true)] private float _colorOverLifetime; [RealtimeProperty(4, true, true)] private float _speedOverLifetime; [RealtimeProperty(5, true, true)] private float _velocityOrbitalX; [RealtimeProperty(6, true, true)] private float _velocityOrbitalY; [RealtimeProperty(7, true, true)] private float _velocityOrbitalZ; [RealtimeProperty(8, true, true)] private bool _toggleEffect; [RealtimeProperty(9, true, true)] private int _colorGradientIndex; [RealtimeProperty(10, true, true)] private Vector3 _position; [RealtimeProperty(11, true, true)] private Quaternion _rotation; [RealtimeProperty(12, true, true)] private Vector3 _scale; } this is the base sync , protected override void OnRealtimeModelReplaced(ParticleSystemModel previousModel, ParticleSystemModel currentModel) { if (previousModel != null) { previousModel.startSpeedDidChange -= OnStartSpeedChanged; previousModel.lifetimeDidChange -= OnLifetimeChanged; previousModel.colorGradientIndexDidChange -= OnColorGradientChanged; } if (currentModel != null) { if (currentModel.isFreshModel) UpdateModelFromParticleSystem(); currentModel.startSpeedDidChange += OnStartSpeedChanged; currentModel.lifetimeDidChange += OnLifetimeChanged; currentModel.colorGradientIndexDidChange += OnColorGradientChanged; } } private void UpdateModelFromParticleSystem() { _isUpdatingModel = true; model.startSpeed = _mainModule.startSpeed.constant; model.lifetime = _mainModule.startLifetime.constant; model.colorGradientIndex = colorGradientDropdown.value; _isUpdatingModel = false; } although the base one doesnt sync the color yet just the first two values
NormalMark
NormalMark5mo ago
Looks fine at first glance. On which specific line inside ParticleSystemSync1.UpdateModelFromParticleSystem does the NullReferenceException occur? This will help narrow it down
Lost Wizard Corp.
this is from the app log is the closest i can see to what its having a problem with , has to one of the values , 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 maybe it needs more time to load the values , maybe i should add OnDidWrite check then update
NormalMark
NormalMark5mo ago
If you're able to repro the issue then you can make a Development build and it will give you the line numbers for the exception
Lost Wizard Corp.
i'll give it go
NormalMark
NormalMark5mo ago
A low-tech approach is also to Debug.Log the value of anything that could be unexpectedly null inside that function (model, _mainModule, colorOverLifetimeKnob, and so on). The idea is to find out which variable is null when it shouldn't be.
Lost Wizard Corp.
that definitely helped some , thanks