Fix SectorCullGroup NRE spam that xen was having (#823)

This commit is contained in:
xen-42 2024-03-23 17:52:30 -04:00 committed by GitHub
commit 0e10d31995
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -140,16 +140,16 @@ namespace NewHorizons.Builder.Props
}
else
{
FixSectoredComponent(component, sector, existingSectors);
}
// Fix cull groups only when not from an asset bundle (because then they're there on purpose!)
// keepLoaded should remove existing groups
// renderers/colliders get enabled later so we dont have to do that here
if (detail.keepLoaded && !isFromAssetBundle && component is SectorCullGroup or SectorCollisionGroup or SectorLightsCullGroup)
{
UnityEngine.Object.DestroyImmediate(component);
continue;
}
// Fix cull groups only when not from an asset bundle (because then they're there on purpose!)
// keepLoaded should remove existing groups
// renderers/colliders get enabled later so we dont have to do that here
if (detail.keepLoaded && !isFromAssetBundle && component is SectorCullGroup or SectorCollisionGroup or SectorLightsCullGroup)
{
UnityEngine.Object.DestroyImmediate(component);
continue;
FixSectoredComponent(component, sector, existingSectors);
}
// Asset bundle is a real string -> Object loaded from unity