move this up so it returns early

This commit is contained in:
JohnCorby 2023-03-23 16:02:45 -07:00
parent 687151c36b
commit 9910323ebc

View File

@ -216,12 +216,6 @@ namespace NewHorizons.Builder.Props
/// </summary>
private static void FixSectoredComponent(Component component, Sector sector, bool isTorch, bool keepLoaded)
{
// fix Sector stuff, eg SectorCullGroup (without this, props that have a SectorCullGroup component will become invisible inappropriately)
if (component is ISectorGroup sectorGroup)
{
sectorGroup.SetSector(sector);
}
// keepLoaded should remove existing groups
// renderers/colliders get enabled later so we dont have to do that here
if (keepLoaded && component is SectorCullGroup or SectorCollisionGroup or SectorLightsCullGroup)
@ -229,6 +223,12 @@ namespace NewHorizons.Builder.Props
Component.DestroyImmediate(component);
return;
}
// fix Sector stuff, eg SectorCullGroup (without this, props that have a SectorCullGroup component will become invisible inappropriately)
if (component is ISectorGroup sectorGroup)
{
sectorGroup.SetSector(sector);
}
// Not doing else if here because idk if any of the classes below implement ISectorGroup