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

Question 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:
    11
    Help Me Pls..... How Detect Divices Mobile or Desktop in Tiny
     
  2. AbdulAlgharbi

    AbdulAlgharbi

    Unity Technologies

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

    BaspooGameDev

    Joined:
    Oct 3, 2016
    Posts:
    11

    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:
    319
    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.