生活随笔
收集整理的這篇文章主要介紹了
Unity3D资源管理架构
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在Unity3D引擎中,場景資源文件(.unity)是以2進制格式存儲的,但同時它也有一種基于文本的表現格式。可在Edit>Project Setting>Editor 中設置:
1.使用binary2text.exe(win下目錄:Editor\Data\Tools)可將.unity文件轉換成.txt文件,只需將.unity文件拖拽到binary2text.exe上即可生成.txt;
2.Bin2Text.unity為測試場景場景中只有一個名為“sakyaer”的空物體;
3.對應這樣一個場景,它的文本格式使用YAML格式存儲,信息表如下:
- 其中ClassID是Unity3D中類的序列編號,如:GameObject類ClassID=1,具體類的ID參照官方網站http://docs.unity3d.com/Manual/ClassIDReference.html
- ID項為隨記分配給每個實例的唯一標識
- 資源文件使用m_作為前綴
- 其中m_GameObject (file 0 path 1163297905)表現transform對gameobject的從屬關系
External ReferencesID:
1 (ClassID:
29) SceneSettingsm_ObjectHideFlags
0 (unsigned
int)m_PVSData (
vector)
size 0 (
int)m_PVSObjectsArray (
vector)
size 0 (
int)m_PVSPortalsArray (
vector)
size 0 (
int)m_OcclusionBakeSettings (OcclusionBakeSettings)smallestOccluder
5 (
float)smallestHole
0.25 (
float)backfaceThreshold
100 (
float)ID:
2 (ClassID:
104) RenderSettingsm_Fog
0 (bool)m_FogColor (
0.5 0.5 0.5 1) (ColorRGBA)m_FogMode
3 (
int)m_FogDensity
0.01 (
float)m_LinearFogStart
0 (
float)m_LinearFogEnd
300 (
float)m_AmbientLight (
0.2 0.2 0.2 1) (ColorRGBA)m_SkyboxMaterial (
file 0 path
0) (PPtr<Material>)m_HaloStrength
0.5 (
float)m_FlareStrength
1 (
float)m_FlareFadeSpeed
3 (
float)m_HaloTexture (
file 0 path
0) (PPtr<Texture2D>)m_SpotCookie (
file 0 path
0) (PPtr<Texture2D>)m_ObjectHideFlags
0 (unsigned
int)ID:
3 (ClassID:
127) LevelGameManagerm_ObjectHideFlags
0 (unsigned
int)ID:
4 (ClassID:
157) LightmapSettingsm_ObjectHideFlags
0 (unsigned
int)m_LightProbes (
file 0 path
0) (PPtr<LightProbes>)m_Lightmaps (
vector)
size 0 (
int)m_LightmapsMode
1 (
int)m_BakedColorSpace
0 (
int)m_UseDualLightmapsInForward
0 (bool)m_LightmapEditorSettings (LightmapEditorSettings)m_Resolution
50 (
float)m_LastUsedResolution
0 (
float)m_TextureWidth
1024 (
int)m_TextureHeight
1024 (
int)m_BounceBoost
1 (
float)m_BounceIntensity
1 (
float)m_SkyLightColor (
0.86 0.93 1 1) (ColorRGBA)m_SkyLightIntensity
0 (
float)m_Quality
0 (
int)m_Bounces
1 (
int)m_FinalGatherRays
1000 (
int)m_FinalGatherContrastThreshold
0.05 (
float)m_FinalGatherGradientThreshold
0 (
float)m_FinalGatherInterpolationPoints
15 (
int)m_AOAmount
0 (
float)m_AOMaxDistance
0.1 (
float)m_AOContrast
1 (
float)m_LODSurfaceMappingDistance
1 (
float)m_Padding
0 (
int)m_TextureCompression
0 (bool)m_LockAtlas
0 (bool)ID:
5 (ClassID:
196) NavMeshSettingsm_ObjectHideFlags
0 (unsigned
int)m_BuildSettings (NavMeshBuildSettings)agentRadius
0.5 (
float)agentHeight
2 (
float)agentSlope
45 (
float)agentClimb
0.4 (
float)ledgeDropHeight
0 (
float)maxJumpAcrossDistance
0 (
float)accuratePlacement
0 (bool)minRegionArea
2 (
float)widthInaccuracy
16.6667 (
float)heightInaccuracy
10 (
float)m_NavMesh (
file 0 path
0) (PPtr<NavMesh>)ID:
1163297905 (ClassID:
1) GameObjectm_ObjectHideFlags
0 (unsigned
int)m_PrefabParentObject (
file 0 path
0) (PPtr<EditorExtension>)m_PrefabInternal (
file 0 path
0) (PPtr<Prefab>)m_Component (
vector)
size 1 (
int)data (pair)first
4 (
int)second (
file 0 path
1163297906) (PPtr<Component>)m_Layer
0 (unsigned
int)m_Name
"Sakyaer" (
string)m_TagString
"Untagged" (
string)m_Icon (
file 0 path
0) (PPtr<Texture2D>)m_NavMeshLayer
0 (unsigned
int)m_StaticEditorFlags
0 (unsigned
int)m_IsActive
1 (bool)ID:
1163297906 (ClassID:
4) Transformm_ObjectHideFlags
0 (unsigned
int)m_PrefabParentObject (
file 0 path
0) (PPtr<EditorExtension>)m_PrefabInternal (
file 0 path
0) (PPtr<Prefab>)m_GameObject (
file 0 path
1163297905) (PPtr<GameObject>)m_LocalRotation (Quaternionf)x
0 (
float)y
0 (
float)z
0 (
float)w
1 (
float)m_LocalPosition (
0 0 0) (Vector3f)m_LocalScale (
1 1 1) (Vector3f)m_Children (
vector)
size 0 (
int)m_Father (
file 0 path
0) (PPtr<Transform>)m_RootOrder
0 (
int)
4.Unity3D中對于每一個資源文件都會生成對應.meta文件,該文件可以用記事本直接打開;guid(全局唯一標識符,Globally Unique Identifier)是系統隨機生成的對資源的標識符,guid在游戲運行時會被用來生成一個hashid;而根據guid的前兩位0a可以在工程Library目錄下metadate(元數據)0a目錄下找到,對應的二進制文件,該文件可以使用binary2text.exe打開,得到的txt文件,記錄了.meta文件對應資源的所有詳細信息。
guid: 0a4a878577c88654795d8c6aee74368d
參考文獻:http://docs.unity3d.com/Manual/TextualSceneFormat.html
總結
以上是生活随笔為你收集整理的Unity3D资源管理架构的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。