/Assets
- 對應(yīng)
Application.dataPath
- unity的資源目錄须揣,根目錄近哟,只有一個驮审。
project
窗口里的內(nèi)容與之對應(yīng) - 大部分API默認(rèn)資源在Assets目錄中,不需要明確指出Assets路徑椅挣。
但有例外头岔,如AssetDataBase
/**/Resources
- 資源目錄名,可以是子目錄
- 這類目錄下的資源會被打包
- 使用
Resources.Load
加載其中資源 - 如果是在Editor目錄下鼠证,不會打包進(jìn)游戲
/Assets/**/Editor
- 編輯器目錄名峡竣,可以是子目錄。編輯器要用的腳本和資源放在這里面
- 不會被編譯到游戲里去
- Editor目錄里的asset只能被
Editor Script
加載量九,加載APIEditorGUIUtility.Load
- Editor目錄下的腳本組件不要繼承
MonoBehaviour
适掰,因為不能加載到GameObject上
/Assets/Editor Default Resources
- 編輯器腳本使用
EditorGUIUtility.Load
加載資源時颂碧,會在這里面找。
/Assets/Plugins
- 插件目錄类浪,通常放置C/C++擴(kuò)展的靜態(tài)DLL
- 插件目錄里的Editor子目錄只用于編輯器载城,不會打包進(jìn)游戲。
- 插件相關(guān)官方說明
/Assets/Standard Assets
- 使用
menu: Assets > Import Package
加入的標(biāo)準(zhǔn)資源包费就,會放到里面诉瓦。
/Assets/StreamingAssets
- 對應(yīng)
Application.streamingAssetsPath
,只讀的力细。 - StreamingAssets目錄下的資源會被復(fù)制到不同平臺的特定目錄睬澡,詳見官方文檔。
- StreamingAssets目錄下的
*.dll
不會participate in the compilation
眠蚂。 - 官方文檔·StreamingAssets目錄
Application.persistentDataPath
- 游戲在手機(jī)上安裝后才有這個目錄
- 這個目錄可以存放熱更文件
/Temp
- 對應(yīng)
Application.temporaryCachePath
隱藏目錄
unity會忽略下面的目錄或文件
-
.*
類型的文件或目錄 -
*~
類型的文件或目錄 -
cvs
命名的文件或目錄 -
*.tmp
類型的文件 - 系統(tǒng)隱藏目錄
/Assets/Gizmos
Unity’s Gizmos allow you to add graphics to the Scene View to help visualise design details that are otherwise invisible.
The Gizmos.DrawIcon function places an icon in the Scene to act as a marker for a special object or position.
You must place the image file used to draw this icon in a folder called Gizmos in order for it to be located by the DrawIcon function.
特殊目錄和腳本編譯順序
腳本編譯順序影響腳本間的引用煞聪,一個文件使用另一個腳本定義的類,則它需要在另一個腳本之后編譯逝慧。
編譯有4層優(yōu)先級
- 1號優(yōu)先級:Standard Assets, Pro Standard Assets, Plugins目錄下的腳本
- 2號優(yōu)先級:Standard Assets, Pro Standard Assets, Plugins的子孫目錄Editor下的腳本
- 3號優(yōu)先級:其他不再Editor目錄下的腳本
- 4號優(yōu)先級:剩下的Editor目錄下的腳本