@@ -565,7 +565,11 @@ public void Setup(bool _isCollecting = true)
565
565
List < GameObject > errorObjs = new List < GameObject > ( ) ;
566
566
try
567
567
{
568
- SetupDo ( _isCollecting , ref errorObjs ) ;
568
+ SetupDo ( ref errorObjs ) ;
569
+ if ( _isCollecting )
570
+ {
571
+ node . spline . road . isTriggeringGC = true ;
572
+ }
569
573
}
570
574
catch ( System . Exception exception )
571
575
{
@@ -582,7 +586,7 @@ public void Setup(bool _isCollecting = true)
582
586
}
583
587
584
588
585
- private void SetupDo ( bool _isCollecting , ref List < GameObject > _errorObjs )
589
+ private void SetupDo ( ref List < GameObject > _errorObjs )
586
590
{
587
591
if ( edgeObjects == null )
588
592
{
@@ -871,21 +875,8 @@ private void SetupDo(bool _isCollecting, ref List<GameObject> _errorObjs)
871
875
}
872
876
873
877
//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 ) ;
889
880
}
890
881
891
882
@@ -929,17 +920,9 @@ private void SetupLocations()
929
920
//Destroy old objects:
930
921
ClearEOM ( ) ;
931
922
//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 ) ;
937
925
edgeObjectLocations = new List < Vector3 > ( ) ;
938
- if ( edgeObjectRotations != null )
939
- {
940
- edgeObjectRotations . Clear ( ) ;
941
- edgeObjectRotations = null ;
942
- }
943
926
edgeObjectRotations = new List < Vector3 > ( ) ;
944
927
bool bIsCenter = RootUtils . IsApproximately ( horizontalSep , 0f , 0.02f ) ;
945
928
0 commit comments