Skip to content

Commit daca9f7

Browse files
committed
End on quit option
1 parent 4237408 commit daca9f7

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Assets/UXF/Scripts/Session.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@ namespace UXF
1818
public class Session : MonoBehaviour
1919
{
2020
/// <summary>
21-
/// Enable to automatically safely end the session when this object is destroyed (or the application stops running).
21+
/// Enable to automatically safely end the session when the application is quitting.
2222
/// </summary>
23-
[Tooltip("Enable to automatically safely end the session when this object is destroyed (or the application stops running).")]
23+
[Tooltip("Enable to automatically safely end the session when the application is quitting.")]
24+
public bool endOnQuit = true;
25+
26+
/// <summary>
27+
/// Enable to automatically safely end the session when this object is destroyed.
28+
/// </summary>
29+
[Tooltip("Enable to automatically safely end the session when this object is destroyed.")]
2430
public bool endOnDestroy = true;
2531

2632
/// <summary>
@@ -577,6 +583,14 @@ public void ReadSettingsFile(string path, System.Action<Dictionary<string, objec
577583
fileIOManager.ManageInWorker(() => fileIOManager.ReadJSON(path, action));
578584
}
579585

586+
void OnApplicationQuit()
587+
{
588+
if (endOnQuit)
589+
{
590+
End();
591+
}
592+
}
593+
580594
void OnDestroy()
581595
{
582596
if (endOnDestroy)

0 commit comments

Comments
 (0)