0
Answered

Application.platform == RuntimePlatform.Android

eagleeyez 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 4

Application.platform == RuntimePlatform.Android

  Hi, In Playmaker I use the following script below to access my SD card on Android. How do I find this Application.Platform in Ludig? Or do I have to install something else? I have JDK and SDK setup in Unity.

using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
 
public class findSdcard : MonoBehaviour {
 
	
	
	
    public string GetAndroidInternalFilesDir()
    {
        string[] potentialDirectories = new string[]
        {
            "/storage/5E0C-2B26/video/",
            "/mnt/sdcard/video/",
        "/sdcard/video",
        "/storage/sdcard0/video",
        "/storage/sdcard1/video"
        };
 
        if (Application.platform == RuntimePlatform.Android)
        {
            for (int i = 0; i < potentialDirectories.Length; i++)
            {
                if (Directory.Exists(potentialDirectories[i]))
                {
                    return potentialDirectories[i];
                }
            }
        }
        return "";
    }
}


Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):

Did you go into Ludiq Properties and add Application as a type? You'll also need to add RuntimePlatform as well if it isn't.

Oh Thanks. I did, but I added the wrong one. Now I've got the right one and it works.

Many thanks

+1

This is what I got in Bolt just using debug to show the false or true when on Android. Thanks again.