Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  After update I get "ArgumentNullException: Value cannot be null"
#1
Hey,

I just updated to the latest version, and I was using an older version from April.

Now I get this error for every solver in the scene on every frame.
Any idea what is wrong?

I tried to delete the whole Obi folder and reimported but it didn't help.



ArgumentNullException: Value cannot be null.
Parameter name: key
System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key) (at <fb001e01371b4adca20013e0ac763896>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].TryGetValue (TKey key, TValue& value) (at <fb001e01371b4adca20013e0ac763896>:0)
Obi.ObiTriangleMeshContainer.GetOrCreateTriangleMesh (UnityEngine.Mesh source) (at Assets/Obi/Scripts/Common/Collisions/ObiTriangleMeshContainer.cs:78)
Obi.ObiColliderWorld.GetOrCreateTriangleMesh (UnityEngine.Mesh mesh) (at Assets/Obi/Scripts/Common/Collisions/ObiColliderWorld.cs:229)
Obi.ObiMeshShapeTracker.UpdateIfNeeded () (at Assets/Obi/Scripts/Common/Collisions/ColliderTrackers/Trackers3D/ObiMeshShapeTracker.cs:38)
Obi.ObiColliderBase.UpdateIfNeeded () (at Assets/Obi/Scripts/Common/Collisions/ObiColliderBase.cs:189)
Obi.ObiColliderWorld.UpdateWorld () (at Assets/Obi/Scripts/Common/Collisions/ObiColliderWorld.cs:362)
Obi.ObiUpdater.BeginStep (System.Single stepDeltaTime) (at Assets/Obi/Scripts/Common/Updaters/ObiUpdater.cs:40)
Obi.ObiFixedUpdater.FixedUpdate () (at Assets/Obi/Scripts/Common/Updaters/ObiFixedUpdater.cs:54)



Also, when I try to Build my project I get this. Any idea why this is happening?


Shader error in 'Obi/URP/Particles': failed to open source file: 'Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl' at Assets/Obi/Resources/ObiMaterials/URP/ObiLightingURP.cginc(5) (on metal)

Compiling Vertex program
Platform defines: UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF3 SHADER_API_MOBILE UNITY_HARDWARE_TIER1 UNITY_COLORSPACE_GAMMA UNITY_LIGHTMAP_DLDR_ENCODING
Reply
#2
Hi there,

Can't reproduce the first error, either in a blank project or updating from 5.3 to 5.6.2. Make sure you don't have configurable enter play mode options enabled, as these aren't supported.

Regarding the shader error: if you're not using URP, you can just get rid of the Assets/Obi/Resources/ObiMaterials/URP folder. These materials are meant for URP support.
Reply
#3
(08-12-2020, 09:40 AM)josemendez Wrote: Hi there,

Can't reproduce the first error, either in a blank project or updating from 5.3 to 5.6.2. Make sure you don't have configurable enter play mode options enabled, as these aren't supported.

Regarding the shader error: if you're not using URP, you can just get rid of the Assets/Obi/Resources/ObiMaterials/URP folder. These materials are meant for URP support.


The null argument error only happens in my current scene. But it does not happen if I open the demo scenes, or if I create a new scene, and place my prefab'ed solver from the problematic scene.

Does that give a clue of what is wrong?
Reply
#4
(08-12-2020, 03:26 PM)emz06 Wrote: The null argument error only happens in my current scene. But it does not happen if I open the demo scenes, or if I create a new scene, and place my prefab'ed solver from the problematic scene.

Does that give a clue of what is wrong?

Do you have references to null meshes in your scene? For instance, a MeshCollider taking no mesh as input? I think this might be a bug in Obi, caused by null meshes being passed to the collider system.

Edit: this is a bug in Obi indeed. Having a MeshCollider with no mesh input in the scene triggers it. To fix it, modify the GetOrCreateTriangleMesh() method in ObiTriangleMeshContainer.cs so that it starts like this:

Quote:ObiTriangleMeshHandle handle = new ObiTriangleMeshHandle(null);

if (source != null && !handles.TryGetValue(source, out handle))
{

Edit2: seems like this fix isn't working properly in some cases. Will spend a bit more time investigating and get back with a more robust fix.

Thanks for reporting this!
Reply
#5
(08-12-2020, 03:29 PM)josemendez Wrote: Do you have references to null meshes in your scene? For instance, a MeshCollider taking no mesh as input? I think this might be a bug in Obi, caused by null meshes being passed to the collider system.

Edit: this is a bug in Obi indeed. Having a MeshCollider with no mesh input in the scene triggers it. To fix it, modify the GetOrCreateTriangleMesh() method in ObiTriangleMeshContainer.cs so that it starts like this:


Edit2: seems like this fix isn't working properly in some cases. Will spend a bit more time investigating and get back with a more robust fix.

Thanks for reporting this!

Thanks for that.
I did check all my mesh colliders, and I didn't find one which was null.

Even with your modification, I am getting a NullReferenceException *at the same moment* that I press the Play button (that is: BEFORE the scene is played):
(then I get this exception once per frame)


NullReferenceException: Object reference not set to an instance of an object
Obi.ObiParticleRenderer.get_ParticleMeshes () (at Assets/Obi/Scripts/Common/Rendering/ObiParticleRenderer.cs:27)
Obi.FluidRenderingUtils.VolumeReconstruction (UnityEngine.Rendering.CommandBuffer cmd, Obi.FluidRenderingUtils+FluidRenderTargets renderTargets, UnityEngine.Material thickness_Material, UnityEngine.Material colorMaterial, Obi.ObiParticleRenderer[] renderers) (at Assets/Obi/Scripts/Fluid/Rendering/FluidRenderingUtils.cs:137)
Obi.ObiFluidRenderer.UpdateFluidRenderingCommandBuffer () (at Assets/Obi/Scripts/Fluid/Rendering/ObiFluidRenderer.cs:118)
Obi.ObiBaseFluidRenderer.OnPreRender () (at Assets/Obi/Scripts/Fluid/Rendering/ObiBaseFluidRenderer.cs:80)
UnityEngine.GUIUtility: ProcessEvent(Int32, IntPtr) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:197)

EDIT:
I think it has to do with the script ObiKinematicVelocities.cs, which seems to have been removed in the new version.

I was using this on one of the objects, because I had a fast moving platform, moving sideways, and I wanted to translate the particles on that platform. 
Is there an alternative to ObiKinematicVelocities.cs?
Reply
#6
(08-12-2020, 04:52 PM)emz06 Wrote: Thanks for that.
I did check all my mesh colliders, and I didn't find one which was null.

Even with your modification, I am getting a NullReferenceException *at the same moment* that I press the Play button (that is: BEFORE the scene is played):
(then I get this exception once per frame)


NullReferenceException: Object reference not set to an instance of an object
Obi.ObiParticleRenderer.get_ParticleMeshes () (at Assets/Obi/Scripts/Common/Rendering/ObiParticleRenderer.cs:27)
Obi.FluidRenderingUtils.VolumeReconstruction (UnityEngine.Rendering.CommandBuffer cmd, Obi.FluidRenderingUtils+FluidRenderTargets renderTargets, UnityEngine.Material thickness_Material, UnityEngine.Material colorMaterial, Obi.ObiParticleRenderer[] renderers) (at Assets/Obi/Scripts/Fluid/Rendering/FluidRenderingUtils.cs:137)
Obi.ObiFluidRenderer.UpdateFluidRenderingCommandBuffer () (at Assets/Obi/Scripts/Fluid/Rendering/ObiFluidRenderer.cs:118)
Obi.ObiBaseFluidRenderer.OnPreRender () (at Assets/Obi/Scripts/Fluid/Rendering/ObiBaseFluidRenderer.cs:80)
UnityEngine.GUIUtility: ProcessEvent(Int32, IntPtr) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:197)

EDIT:
I think it has to do with the script ObiKinematicVelocities.cs, which seems to have been removed in the new version.

I was using this on one of the objects, because I had a fast moving platform, moving sideways, and I wanted to translate the particles on that platform. 
Is there an alternative to ObiKinematicVelocities.cs?

Hi,

ObiKinematicVelocities is now part of the core engine. You should just remove it. See the changelog for 5.6.1:
Quote:## [5.6.1]

### Fixed
- Bug in Burst backend: solver bounding box size was typically underestimated.
- Bug in Burst backend: when using volume constraints: "InvalidOperationException: The NativeContainer ApplyVolumeConstraintsBatchJob.particleIndices has not been assigned or constructed"
- Bug in Burst backend: not releasing native arrays when empty solvers -with zero actors in them- are present in the scene.
- Bug in Oni backend: volume constraints not working properly when multiple actors are present in the solver.
- Fixed crash when using ObiLateUpdater or ObiLateFixedUpdater with the Burst backend.
- Reduced GC allocation in dynamic particle attachments.
- Fixed bug in Skin constraints, that caused them to fail restricting particle movement in certain circumstances.

### Changed
- Updated Oni iOS library to XCode 12.1. Make sure to use XCode 12.1 or up to build for iOS when using the Oni backend.
- ObiKinematicVelocities component has been removed. Its functionality is now built into the engine, and automatically used for kinematic rigidbodies.

### Added
- Sample ObiContactDispatcher component, that will call custom enter/stay/exit contact events.
- Support for multiple solvers in sample script in ObiContactGrabber.
- Added util LookAroundCamera component.
Reply
#7
Thanks for the clarification.

The problem seems to have disappeared.

I'm not sure what solved it, but I went to my camera, set the size of Particle Renderers to 0, then I added every emitter in the scene, one at a time, and played the scene every time.

For some reason, they started working again.

Thanks for your help!
Reply