zoukankan      html  css  js  c++  java
  • 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<string> CurrentTextureList;
    }
    

      

     

  • 相关阅读:
    【转载】[C#]Log4net中的RollingFileAppender解析
    【转载】大数据量传输时配置WCF的注意事项
    Sql 数据引擎中删除用户名、密码信息
    win10 HTTP 错误 500.21
    SQL Server 将Id相同的字段合并,并且以逗号隔开
    C#中2个日期类型相减
    sql server 查询本年的每个月的数据
    sql server 查询本周、本月所有天数的数据
    sql server中的日期函数
    Sql Server 逻辑文件 '' 不是数据库 '' 的一部分。请使用 RESTORE FILELISTONLY 来列出逻辑文件名。
  • 原文地址:https://www.cnblogs.com/WalkingSnail/p/10839176.html
Copyright © 2011-2022 走看看