Manual

Orientation Detector

Code examples to perform various interactions with the OrientationDetector

Check Device Orientation

Check the current orientation and updates it if it changed. This method is called automatically by the OrientationDetector.

using Doozy.Engine.Orientation;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    private void Start()
    {
        OrientationDetector.Instance.CheckDeviceOrientation();
    }
}

Change Orientation

Update the current orientation to the given MyOrientation and invoke OnOrientationEvent

using Doozy.Engine.Orientation;
using UnityEngine;

public class ExampleClass : MonoBehaviour
{
    public DetectedOrientation MyOrientation = DetectedOrientation.Landscape;
    
    private void Start()
    {
       OrientationDetector.Instance.ChangeOrientation(MyOrientation);
    }
}