Skip to content

Commit 2ad12a8

Browse files
committed
Made RandomGenerator static so that it wouldn't get reinitialized on each scene change
1 parent 01a9552 commit 2ad12a8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

TestFlightCore/TestFlightCore/TestFlight.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ public class TestFlightManagerScenario : ScenarioModule
634634

635635
public static TestFlightManagerScenario Instance { get; private set; }
636636

637-
public System.Random RandomGenerator { get; private set; }
637+
public static System.Random RandomGenerator { get; private set; }
638638

639639
public bool isReady = false;
640640
// For storing save specific arbitrary data
@@ -926,7 +926,11 @@ public override void OnAwake()
926926
public void Start()
927927
{
928928
Log("Scenario Start");
929-
RandomGenerator = new System.Random();
929+
if (RandomGenerator == null)
930+
{
931+
RandomGenerator = new System.Random();
932+
}
933+
930934
isReady = true;
931935
}
932936

TestFlightCore/TestFlightCore/TestFlightCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public System.Random RandomGenerator
178178
{
179179
get
180180
{
181-
return TestFlightManagerScenario.Instance.RandomGenerator;
181+
return TestFlightManagerScenario.RandomGenerator;
182182
}
183183
}
184184

0 commit comments

Comments
 (0)