EchoTrio
 
Loading...
Searching...
No Matches
AuthenticationChecker.cs
Go to the documentation of this file.
1using UnityEngine;
2using UnityEngine.InputSystem;
3using UnityEngine.SceneManagement;
4
6 /// MonoBehaviour to check if the authentication file exists before starting the experience.
7 public class AuthenticationChecker : MonoBehaviour {
8 [Header("References")]
9 [SerializeField] private GameObject failureText = null;
10
11 [Header("Settings")]
12 [SerializeField] private string nextScene = "Playtest";
13
14 // Internal Variable
15 private GameInputActions gameInputActions = null;
16
17 private void Awake() {
18 gameInputActions = new GameInputActions();
19 failureText.gameObject.SetActive(false);
20 }
21
22 private void OnEnable() {
23 gameInputActions.Enable();
24 gameInputActions.Game.Quit.performed += OnQuit;
25 }
26
27 private void OnDisable() {
28 gameInputActions.Disable();
29 gameInputActions.Game.Quit.performed -= OnQuit;
30 }
31
32 private void Start() {
34 SceneManager.LoadScene(nextScene);
35 } else {
36 failureText.gameObject.SetActive(true);
37 }
38 }
39
40 // Input Action Callbacks
41 private void OnQuit(InputAction.CallbackContext context) {
42 Application.Quit();
43 }
44 }
45}
Helper class to load the authentication file and retrieve API keys.
static bool AuthenticationFileExists()
MonoBehaviour to check if the authentication file exists before starting the experience.
void OnQuit(InputAction.CallbackContext context)