Wait for correct screen orientation
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using System;
|
||||
using Input;
|
||||
using Settings;
|
||||
|
||||
namespace Utility
|
||||
@@ -66,6 +67,7 @@ namespace Utility
|
||||
orientationCorrect = IsOrientationCorrect();
|
||||
if (!orientationCorrect)
|
||||
{
|
||||
InputManager.Instance.SetInputMode(InputMode.UI);
|
||||
ShowPrompt();
|
||||
orientationCheckCoroutine = StartCoroutine(OrientationCheckRoutine());
|
||||
}
|
||||
@@ -77,7 +79,11 @@ namespace Utility
|
||||
return scene.name == "Main Menu" || scene.name == "MainMenu";
|
||||
}
|
||||
|
||||
private bool IsOrientationCorrect()
|
||||
/// <summary>
|
||||
/// Checks if the current device orientation matches the required orientation for the scene
|
||||
/// </summary>
|
||||
/// <returns>True if the orientation is correct, false otherwise</returns>
|
||||
public bool IsOrientationCorrect()
|
||||
{
|
||||
switch (requiredOrientation)
|
||||
{
|
||||
@@ -121,6 +127,8 @@ namespace Utility
|
||||
StopCoroutine(orientationCheckCoroutine);
|
||||
orientationCheckCoroutine = null;
|
||||
}
|
||||
|
||||
InputManager.Instance.SetInputMode(InputMode.Game);
|
||||
}
|
||||
|
||||
private void CleanupPromptAndCoroutine()
|
||||
|
||||
Reference in New Issue
Block a user