码迷,mamicode.com
首页 > 编程语言 > 详细

Unity3D资源管理架构

时间:2015-06-06 19:38:21      阅读:271      评论:0      收藏:0      [点我收藏+]

标签:引擎   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 References


ID: 1 (ClassID: 29) SceneSettings
    m_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) RenderSettings
    m_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) LevelGameManager
    m_ObjectHideFlags 0 (unsigned int)


ID: 4 (ClassID: 157) LightmapSettings
    m_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) NavMeshSettings
    m_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) GameObject
    m_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) Transform
    m_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)

参考文献:http://docs.unity3d.com/Manual/TextualSceneFormat.html

Unity3D资源管理架构

标签:引擎   unity3d   资源管理   

原文地址:http://blog.csdn.net/sakyaer/article/details/46390615

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!