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;
    }
    

      

     

  • 相关阅读:
    各类免费资料及书籍索引大全(珍藏版)
    转—如何写一篇好的技术博客
    如何写技术博客
    Spring + Spring MVC + Mybatis 框架整合
    Httpclient 4.5.2 请求http、https和proxy
    HttpClient4.5.2 连接池原理及注意事项
    php加密数字字符串,使用凯撒密码原理
    php 阿里云视频点播事件回调post获取不到参数
    Nginx代理后服务端使用remote_addr获取真实IP
    记录:mac的浏览器访问任何域名、网址都跳转到本地127.0.0.1或固定网址
  • 原文地址:https://www.cnblogs.com/WalkingSnail/p/10839176.html
Copyright © 2011-2022 走看看