Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Null reference exception on start (do not disable scene reload *solved)
#1
hi everyone I have a very weird problem that I have trouble figuring out. 

I have imported obi rope 6.2 into a 2021.1.19f1 vr hdrp project I am working on and when I try to start a scene with a rope or rod all I get is a null ref exception in ObiConstraints.cs 

actor.solverBatchOffsets[constraintType].Clear();

explicitly solverBatchOffsets is what is null. 
Backend used doesn't matter 

My testscene is empty except for camera, directional light and obi rope and obi solver. The blueprint is also unaltered straight from create asset.

In a completely new project (same unity version, hdrp, steam vr too) the issue does not appear. 


Why could this go wrong? Is there a way I can hotfix this?

---
I suspect that either Awake isn't called correctly on ObiActor or that solverBatchOffsets is not serialized. In any case when I check if solverbatchOffsets is null in ObiActor.OnEnable it does return null as well. Initializing it in OnEnable prevents the error but breaks the simulation.

--- figured it out ---
Awake isn't called (and I guess on many other important components too) when you have Scene reload disabled Rodar ojos Astuto (I am stupid, hopefulyl this spares someone else the hours to find out)
Reply
#2
(10-09-2021, 01:21 PM)fleity Wrote: hi everyone I have a very weird problem that I have trouble figuring out. 

I have imported obi rope 6.2 into a 2021.1.19f1 vr hdrp project I am working on and when I try to start a scene with a rope or rod all I get is a null ref exception in ObiConstraints.cs 

actor.solverBatchOffsets[constraintType].Clear();

explicitly solverBatchOffsets is what is null. 
Backend used doesn't matter 

My testscene is empty except for camera, directional light and obi rope and obi solver. The blueprint is also unaltered straight from create asset.

In a completely new project (same unity version, hdrp, steam vr too) the issue does not appear. 


Why could this go wrong? Is there a way I can hotfix this?

---
I suspect that either Awake isn't called correctly on ObiActor or that solverBatchOffsets is not serialized. In any case when I check if solverbatchOffsets is null in ObiActor.OnEnable it does return null as well. Initializing it in OnEnable prevents the error but breaks the simulation.

--- figured it out ---
Awake isn't called (and I guess on many other important components too) when you have Scene reload disabled Rodar ojos Astuto (I am stupid, hopefulyl this spares someone else the hours to find out)


It did spare me the hours to find! Thank you for including the solution  Sonrisa

-bump-
Reply