unity怎么实现linux目录文件,unity+adnroid+根目录创建文件夹

直接上代码:

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using System.IO;

using UnityEngine.UI;

public class TKGameInit : MonoBehaviour {

public Text pathText;

private void Awake()

{

#if UNITY_ANDROID

Debug.LogError("777788888");

TKGlobalData.CurrentSaveDataPath = "/sdcard/TKData/SaveData/";

if (!Directory.Exists(TKGlobalData.CurrentSaveDataPath))

{

Directory.CreateDirectory(TKGlobalData.CurrentSaveDataPath);

}

TKGlobalData.CurrentLoadDataPath = "/sdcard/TKData/ServerData/";

if (!Directory.Exists(TKGlobalData.CurrentLoadDataPath))

{

Directory.CreateDirectory(TKGlobalData.CurrentLoadDataPath);

}

pathText.text = TKGlobalData.CurrentLoadDataPath;

#elif UNITY_EDITOR

//Debug.LogError("1111122222222");

TKGlobalData.CurrentSaveDataPath = Application.persistentDataPath + "/SaveData/data/";

TKGlobalData.CurrentLoadDataPath = Application.persistentDataPath+"/";

if (!Directory.Exists(TKGlobalData.CurrentSaveDataPath))

{

Directory.CreateDirectory(TKGlobalData.CurrentSaveDataPath);

}

if (!Directory.Exists(TKGlobalData.CurrentLoadDataPath))

{

Directory.CreateDirectory(TKGlobalData.CurrentLoadDataPath);

Debug.LogError("7222111");

}

pathText.text = TKGlobalData.CurrentLoadDataPath;

#endif

}

// Use this for initialization

void Start () {

}

// Update is called once per frame

void Update () {

}

}

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class TKGlobalData

{

public static string Btn_CuetomName="";

public static string VideoPath = Application.persistentDataPath + "/MulPhotos/";

public static string UserName;

public static bool IsMan;

public static int userID;

public static int loadUserID;

public static int checkID;

public static int CurrentSelectProjectID;//当前选择项目ID

public static int currentSelectEquiID;//d当前选择设备ID

public static int currentSelectWorkShopID;//当前选择厂房ID

public static string currentServerDataPath = Application.persistentDataPath;

public static string CurrentSaveDataPath;

public static string CurrentLoadDataPath;

public static List CurrentTextureList;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值