Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 0a7f769

Browse files
authored
Merge pull request #170 from github-for-unity/fixes/first-run-is-first
Caching the initial FirstRun value before modifying it if necessary
2 parents 258776a + c3cb1da commit 0a7f769

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,32 @@
22
using System.Collections.Generic;
33
using UnityEditor;
44
using UnityEngine;
5+
using Debug = System.Diagnostics.Debug;
56

67
namespace GitHub.Unity
78
{
89
sealed class ApplicationCache : ScriptObjectSingleton<ApplicationCache>
910
{
1011
[SerializeField] private bool firstRun = true;
12+
13+
[NonSerialized] private bool? val;
14+
1115
public bool FirstRun
1216
{
1317
get
1418
{
15-
var val = firstRun;
19+
if (!val.HasValue)
20+
{
21+
val = firstRun;
22+
}
23+
1624
if (firstRun)
1725
{
1826
firstRun = false;
1927
Save(true);
2028
}
21-
return val;
29+
30+
return val.Value;
2231
}
2332
}
2433
}

0 commit comments

Comments
 (0)