Application

1、 靜態(tài)屬性

1.1 Path路徑

屬性名 描述
dataPath 返回項(xiàng)目所在的assert文件夾的相對(duì)目錄(相對(duì)路徑)
streamingAssetsPath 返回流數(shù)據(jù)緩存目錄(相對(duì)路徑)
persistentDataPath 返回持久化目錄,同平臺(tái)不同程序調(diào)用此屬性,返回值相同
temporaryCachePath 臨時(shí)數(shù)據(jù)緩存目錄,同平臺(tái)不同程序調(diào)用返回值相同

注:不同平臺(tái)下,位置不同

Debug.Log("dataPath:" + Application.dataPath);
Debug.Log("streamingAssetsPath:" + Application.streamingAssetsPath);
Debug.Log("persistentDataPath:" + Application.persistentDataPath);
Debug.Log("temporaryCachePath:" + Application.temporaryCachePath);
image.png

1.2 loadedLevel 關(guān)卡屬性

//返回當(dāng)前場(chǎng)景的索引值,依據(jù)BuildSetting當(dāng)前scene的索引順序有關(guān)
Debug.Log("loadedLevel:" + Application.loadedLevel);
//返回當(dāng)前場(chǎng)景的名字
Debug.Log("loadedLevelName:" + Application.loadedLevelName);
//是否有場(chǎng)景正在被加載
Debug.Log("isLoadingLevel:" + Application.isLoadingLevel);
//返回游戲中可被加載的場(chǎng)景數(shù)量,依據(jù)BuildSetting中勾選的數(shù)量有關(guān)
Debug.Log("levelCount:" + Application.levelCount);
//返回當(dāng)前游戲的運(yùn)行平臺(tái)
Debug.Log("platform:" + Application.platform);
//當(dāng)前游戲是否正在運(yùn)行
Debug.Log("isPlaying:" + Application.isPlaying);
//當(dāng)前游戲是否處于Unity編輯模式
Debug.Log("isEditor:" + Application.isEditor);
image.png
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容