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