Search Unity

  1. Unity 2020.2 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Help Wanted How Detect Divices Mobile or Desktop in Tiny?

Discussion in 'Project Tiny' started by BaspooGameDev, Nov 16, 2020.

  1. BaspooGameDev

    BaspooGameDev

    Joined:
    Oct 3, 2016
    Posts:
    9
    Help Me Pls..... How Detect Divices Mobile or Desktop in Tiny
     
  2. AbdulAlgharbi

    AbdulAlgharbi

    Unity Technologies

    Joined:
    Jul 27, 2018
    Posts:
    258
  3. BaspooGameDev

    BaspooGameDev

    Joined:
    Oct 3, 2016
    Posts:
    9

    I Build Tiny to wasm platform. but i can't detect Divices on run time.

    example

    if (Application.platform == RuntimePlatform.Android)
    {

    }

    or

    if (SystemInfo.deviceType == DeviceType.Desktop)
    {

    }
     
  4. AbdulAlgharbi

    AbdulAlgharbi

    Unity Technologies

    Joined:
    Jul 27, 2018
    Posts:
    258
    You need to do

    Code (CSharp):
    1.  
    2. #if UNITY_WEBGL
    3. // WebGL code
    4. #endif
    5. #if UNITY_ANDROID
    6. // Android code
    7. #endif
    8.  
     
unityunity