Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to i can get device solution and orientation ?

Discussion in 'Project Tiny' started by alamac123, Feb 28, 2019.

  1. alamac123

    alamac123

    Joined:
    Mar 15, 2017
    Posts:
    22
    Thank for your help!
     
  2. Rupture13

    Rupture13

    Joined:
    Apr 12, 2016
    Posts:
    129
    You can use ut.Core2D.DisplayInfo, which is stored in the configData in the world.

    For example:
    (adapted from TinyArmsRevenge code)
    Code (CSharp):
    1. let displayInfo = this.world.getConfigData(ut.Core2D.DisplayInfo);
    2. let aspectRatio = displayInfo.frameHeight / displayInfo.frameWidth;
    3. let referenceRatio = 16 / 9;
    4. let isTallDisplay = aspectRatio > referenceRatio + 0.01;
     
    Maras likes this.
  3. alamac123

    alamac123

    Joined:
    Mar 15, 2017
    Posts:
    22
    Thank you very much.