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.

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.