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

Handle edge case for empty meshfilters #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Jan 15, 2022

  1. Handle edge case for empty meshfilters

    Having empty meshfilters in the scene causes the system to fail. Resulting in an error:
    
    ```
    NullReferenceException: Object reference not set to an instance of an object
    SamDriver.Decal.DecalMesh+<WorldMeshFilters>d__55.MoveNext () (at Packages/com.samdriver.driven-decals/Runtime/DecalMesh.cs:408)
    SamDriver.Decal.MeshProjection.ScheduleTrimJobs (System.Collections.Generic.List`1[SamDriver.Decal.RawMesh]& rawMeshes, System.Collections.Generic.List`1[Unity.Collections.NativeArray`1[SamDriver.Decal.Triangle]]& allResultingTriangles, System.Collections.Generic.List`1[Unity.Jobs.JobHandle]& trimJobHandles, UnityEngine.Transform decalTransform, System.Collections.Generic.IEnumerable`1[T] meshFilters, System.Boolean shouldUsePersistentAllocation, System.Boolean immediatelyStart) (at Packages/com.samdriver.driven-decals/Runtime/MeshProjection.cs:164)
    SamDriver.Decal.MeshProjection.GenerateProjectedDecalMesh (System.Collections.Generic.IEnumerable`1[T] meshFilters, UnityEngine.Transform decalTransform) (at Packages/com.samdriver.driven-decals/Runtime/MeshProjection.cs:269)
    SamDriver.Decal.DecalMesh.GenerateProjectedMeshImmediate () (at Packages/com.samdriver.driven-decals/Runtime/DecalMesh.cs:313)
    SamDriver.Decal.DecalMeshInspector.ProjectMeshButtonGUI (SamDriver.Decal.DecalMesh primaryItem, SamDriver.Decal.DecalMesh[] items, System.Boolean isEditingMultipleObjects) (at Packages/com.samdriver.driven-decals/Editor/DecalMeshInspector.cs:89)
    SamDriver.Decal.DecalMeshInspector.OnInspectorGUI () (at Packages/com.samdriver.driven-decals/Editor/DecalMeshInspector.cs:42)
    UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <60f4a7b331a5480aaa94dbc2506830d5>:0)
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    ```
    
    Adding this check prevents this edge case from breaking DecalMesh.
    thnewlands authored Jan 15, 2022
    Configuration menu
    Copy the full SHA
    f85facf View commit details
    Browse the repository at this point in the history