Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullReferenceException #23

Open
GodkongGit opened this issue Dec 5, 2024 · 1 comment
Open

NullReferenceException #23

GodkongGit opened this issue Dec 5, 2024 · 1 comment

Comments

@GodkongGit
Copy link

GodkongGit commented Dec 5, 2024

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

@GodkongGit
Copy link
Author

Hello again! I was able to get around this by entering Debug mode from the Inspector window's context menu, setting "All static meshes" to false, and choosing a Target mesh. After doing that and leaving debug mode, everything seems to work as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant