Skip to content

Commit 8573a0f

Browse files
committed
Changed EdgeObjectMaker to use NullifyList
1 parent c28d700 commit 8573a0f

File tree

1 file changed

+10
-27
lines changed

1 file changed

+10
-27
lines changed

Scripts/EdgeObjectMaker.cs

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,11 @@ public void Setup(bool _isCollecting = true)
565565
List<GameObject> errorObjs = new List<GameObject>();
566566
try
567567
{
568-
SetupDo(_isCollecting, ref errorObjs);
568+
SetupDo(ref errorObjs);
569+
if (_isCollecting)
570+
{
571+
node.spline.road.isTriggeringGC = true;
572+
}
569573
}
570574
catch (System.Exception exception)
571575
{
@@ -582,7 +586,7 @@ public void Setup(bool _isCollecting = true)
582586
}
583587

584588

585-
private void SetupDo(bool _isCollecting, ref List<GameObject> _errorObjs)
589+
private void SetupDo(ref List<GameObject> _errorObjs)
586590
{
587591
if (edgeObjects == null)
588592
{
@@ -871,21 +875,8 @@ private void SetupDo(bool _isCollecting, ref List<GameObject> _errorObjs)
871875
}
872876

873877
//Zero these out, as they are not needed anymore:
874-
if (edgeObjectLocations != null)
875-
{
876-
edgeObjectLocations.Clear();
877-
edgeObjectLocations = null;
878-
}
879-
if (edgeObjectRotations != null)
880-
{
881-
edgeObjectRotations.Clear();
882-
edgeObjectRotations = null;
883-
}
884-
885-
if (_isCollecting)
886-
{
887-
node.spline.road.isTriggeringGC = true;
888-
}
878+
RootUtils.NullifyList(ref edgeObjectLocations);
879+
RootUtils.NullifyList(ref edgeObjectRotations);
889880
}
890881

891882

@@ -929,17 +920,9 @@ private void SetupLocations()
929920
//Destroy old objects:
930921
ClearEOM();
931922
//Make sure old locs and rots are fresh:
932-
if (edgeObjectLocations != null)
933-
{
934-
edgeObjectLocations.Clear();
935-
edgeObjectLocations = null;
936-
}
923+
RootUtils.NullifyList(ref edgeObjectLocations);
924+
RootUtils.NullifyList(ref edgeObjectRotations);
937925
edgeObjectLocations = new List<Vector3>();
938-
if (edgeObjectRotations != null)
939-
{
940-
edgeObjectRotations.Clear();
941-
edgeObjectRotations = null;
942-
}
943926
edgeObjectRotations = new List<Vector3>();
944927
bool bIsCenter = RootUtils.IsApproximately(horizontalSep, 0f, 0.02f);
945928

0 commit comments

Comments
 (0)