Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

is it possible to simulate device orientation in EDITOR?

Discussion in 'iOS and tvOS' started by VaygrEmpire, Mar 5, 2020.

  1. VaygrEmpire

    VaygrEmpire

    Joined:
    Sep 30, 2016
    Posts:
    40
    something like

    Code (CSharp):
    1. if (Input.GetKeyDown(KeyCode.A))
    2. {
    3.     Input.deviceOrientation = DeviceOrientation.LandscapeLeft;
    4. }
    is this possible?
     
  2. TomaszMolikRobot

    TomaszMolikRobot

    Joined:
    Jan 14, 2020
    Posts:
    25
    Not sure if that's what you want to achieve but you could change resolution in game panel upper left corner to any resolution that is landscape, like 1920x1080 or other? That way you can see how your game looks in landscape mode.
     
  3. Moonjump

    Moonjump

    Joined:
    Apr 15, 2010
    Posts:
    2,571
    The device orientation is read only, you cannot simulate it, but you don't need to. The value is taken from the Unity Remote device attached when running in the editor.
     
  4. VaygrEmpire

    VaygrEmpire

    Joined:
    Sep 30, 2016
    Posts:
    40
    the reason I'm asking this is because I have this strange situation going on with Google VR. I have a clipboard object that player spawns with, and carry around, but when the device rotates upside down, vr camera rotates as well. The thing is, so does clipboard object. I think this is happening due to VR keep overriding any camera related stuff.

    I'm trying to find a way NOT to do this, but everytime I try something I need to build and test. And Unity Remote doesn't always work in my case, too. So I'm trying to find a way to simulate device rotation in Editor instead of keep re-building and opening xcode which takes enormous amount of time .
     
  5. drewjosh

    drewjosh

    Joined:
    Sep 24, 2019
    Posts:
    23
    Like said before it is readonly. When running in the editor Input.deviceOrientation is unkown, so like Moonjump said it is probably only working with a remote device.

    I need to simulate device orientation, because I want to recalculate stuff when orientation is changed. Any ideas?