Unity3d 在不一樣設備中的文件讀寫 的路徑

 

Application.dataPath : 數據路徑

 
Unity Editor:  <path tp project folder>/Assets
Unity 編輯器: <工程文件夾的路徑>/Assets 

Mac player:  <path to player app bundle>/Contents
Mac播放器: <到播放器應用的路徑>/Contents 

i Phone player:  <path to player app bundle>/<AppName.app>/Data
iPhone播放器: <到播放器應用的路徑>/<AppName.app>/Data 

Win player:  <path to executablename_Data folder>
Win播放器: < 包含可執行播發器的文件夾的路徑>\Data 

Dashboard widget:  <path to the dashboard widget bundle>
Dasboard窗口: < dashboard widget bundle的路徑> 

Web player:  The absolute url to the player data file folder (without the actual data file name)
網絡播放器: 到播放器數據文件夾的絕對路徑(沒有實際的數據文件名稱)
 

 

 在IOS真機設備中 須要在<path to player app bundle>/Documents路徑下才能夠讀寫。  網絡

unity3d中經過以下操做獲取Document文件路徑app

    public string Path
    {
        get{
            string    path=null;
            if(Application.platform==RuntimePlatform.IPhonePlayer)
            {
                path= Application.dataPath.Substring (0, Application.dataPath.Length - 5);
                path = path.Substring(0, path.LastIndexOf('/'))+"/Documents/";    
            }
            else
            {
                path=Application.dataPath+"/Resource/GameData/";
            }
            return path;
        }     
    }
編輯器

相關文章
相關標籤/搜索