fix: stabilize VR UI and song playback
This commit is contained in:
@@ -8,16 +8,64 @@ namespace VRBeats
|
||||
// 나머지 씬: 바로 활성 상태로 추가.
|
||||
public class VRPointerSetup : MonoBehaviour
|
||||
{
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
|
||||
private static VRPointerSetup instance;
|
||||
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||
private static void ResetStatics()
|
||||
{
|
||||
instance = null;
|
||||
}
|
||||
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||
private static void AutoInject()
|
||||
{
|
||||
if (instance != null)
|
||||
return;
|
||||
|
||||
var go = new GameObject("[VRPointerSetup]");
|
||||
go.AddComponent<VRPointerSetup>();
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (instance != null && instance != this)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
return;
|
||||
}
|
||||
|
||||
instance = this;
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
SceneManager.sceneLoaded += OnSceneLoaded;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
SceneManager.sceneLoaded -= OnSceneLoaded;
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
bool isGameScene = SceneManager.GetActiveScene().name == "Game";
|
||||
SetupActiveScene();
|
||||
}
|
||||
|
||||
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
|
||||
{
|
||||
SetupScene(scene);
|
||||
}
|
||||
|
||||
private static void SetupActiveScene()
|
||||
{
|
||||
SetupScene(SceneManager.GetActiveScene());
|
||||
}
|
||||
|
||||
private static void SetupScene(Scene scene)
|
||||
{
|
||||
bool isGameScene = scene.name == "Game";
|
||||
SetupControllers(disabledByDefault: isGameScene);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user