Skip to content

NullReferenceException  #23

@GodkongGit

Description

@GodkongGit

Hey, this worked out of the box in a test project of mine, but will not work in my main project. Newly created Driven Decal objects throw multiple NullReferenceException errors, and the grid texture appears black. I cannot expand the Decal Mesh (Script) component, it is empty and while expanded constantly throws more of the same error. Transforming the decal object in any way within the scene also throws multiple of the same error.
This is the error:

NullReferenceException: Object reference not set to an instance of an object
SamDriver.Decal.DecalMesh+d__55.MoveNext () (at ./Library/PackageCache/com.samdriver.driven-decals@4a70ad783b/Runtime/DecalMesh.cs:407)
System.Linq.Enumerable.Any[TSource] (System.Collections.Generic.IEnumerable`1[T] source) (at :0)
SamDriver.Decal.DecalMesh.get_HasMeshToProjectAgainst () (at ./Library/PackageCache/com.samdriver.driven-decals@4a70ad783b/Runtime/DecalMesh.cs:104)
SamDriver.Decal.DecalMeshInspector.ProjectMeshButtonGUI (SamDriver.Decal.DecalMesh primaryItem, SamDriver.Decal.DecalMesh[] items, System.Boolean isEditingMultipleObjects) (at ./Library/PackageCache/com.samdriver.driven-decals@4a70ad783b/Editor/DecalMeshInspector.cs:72)
SamDriver.Decal.DecalMeshInspector.OnInspectorGUI () (at ./Library/PackageCache/com.samdriver.driven-decals@4a70ad783b/Editor/DecalMeshInspector.cs:42)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass72_0.b__0 () (at <7aeb7d7a52d04045b8a1c734633fa931>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

Based on it working right away in the test project, I feel it's an issue with my main project... but the error is giving me no clues at all. I've tried reimporting and fully removing and reinstalling, but the same issue occurs.
Strangely, the very first time I imported the package, it worked until I tried to Project Mesh. Nothing would happen and it would throw an error, but I can no longer reproduce that as I can't access the script component. It was after reimporting that first time that the current issue began occurring.
Both my main and test projects are using Unity 2022.3.13f1, URP 14.0.9. The main project uses forward rendering, Decals use the DBuffer Technique, with Albedo Normal MAOS Surface Data. Rendering Layers are not enabled. Fiddling with these settings does not seem to do anything however.
I'm pretty lost here so any help would be much appreciated! Having tested the asset in my test project I think it's really sweet (great work, thank you!!) and would love to put it to proper use.
Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions