查看: 2063|回复: 0
打印 上一主题 下一主题

将场景保存为xml文件

[复制链接]

1602

主题

1

听众

2万

积分

资深设计师

Rank: 7Rank: 7Rank: 7

纳金币
24658
精华
6

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

跳转到指定楼层
楼主
发表于 2012-3-21 12:02:36 |只看该作者 |倒序浏览
相当有用的扩展资源,可以将你的场景保存为xml文件,并可以在下次运行的时候再次载入此xml文件,这个对做一些在线的应用就非常的有帮助了,大家可以具体看下其详细的功能!

It has been a while since we last have publicly released another version of ColdScene, but here you are guys with version 0.3.1 of ColdScene.
It has some nice new features and improvements which you can read about below.

New version including the demo can be downloaded here:http://www.apex.dk/technology/downlo...cene_0.3.1.zip


**************************************************
ColdScene - SceneXML v0.3.1 for Unity 3
Copyright 2010 Apex Virtual Entertainment
www.apex.dk

Created by:
Martin Schwartz
Apex Virtual Entertainment
martin@apex.dk
**************************************************

What is ColdScene?
--------------------------------------------------
A small tool to save any Unity scene to XML format.
These XML files can then be loaded (and unloaded) as
scenes in Unity as normal Unity scene files can.


Why ColdScene?
--------------------------------------------------
1. Load events
ColdScene will get pre and post event on loading
of all serialized properties and fields in the scene.

2. Scene unload
Unloading scenes is possible in ColdScene which is
not currently available in Unity.

3. Step-by-step scene load/unload for debugging
With the scene enumerator you are able to bit by bit
load (or unload) a scene bit by bit which can be handy
for debugging.

4. Asynchronous scene loading problem solved
Using Unity's own asynchronous scene loading have previous
caused problems for some and for Apex as well (this might
have been fixed in Unity 3.0 we haven't tested that), so
we have tried to fix this with ColdScene. You also have the
option to choose how much time per frame you want to
use for the loading or unloading which is not currently
with Unity's asynchronous scene load.

What is new in ColdScene 0.3.1?
--------------------------------------------------
- Scene loading/unloading under specified transform parents
- Prioritized monobehaviour events (optional to use)
- LOD system (optional to use but must use prioritized monobehaviour events)
- Optimized search algorithm for scene items
- Option to load scenes with renderers disabled to allow scene to be loaded invisble
to for example allow syncing between scenes when doing LOD changes in the world
- Multiple instances of a scene is now allowed (one instance per parent)
- Fixes to allow lists of custom made serializable classes

How do I install ColdScene?
--------------------------------------------------
Import the included unity package into your project.
The package includes a .dll file which must be in your
unity project, it includes some editor scripts to save
your scenes and it also includes some test
scripts/assets/scenes which are just demonstration of
how ColdScene works, which most of you probably want to
re-write yourself.


How does ColdScene work?
--------------------------------------------------
Saving:
-------
Select the root of the scene you want to save. Click on
"ColdScene/Save scene to XML" to create the XML file.
An asset bundle will also be created that contains
all its dependencies and the XML file. It will be saved
in a subfolder of the Assets folder called "scenes".

Synchronous loading:
--------------------
Use: SceneManager.Get().LoadScene(string bucketId, float priority, string name,
IScenePartObserver[] observers, Transform parent, bool makeInvisible)
(e.g. SceneManager.Get().LoadScene("Root", 0, "Root"), where "Root" is the
name of the asset bundle in the "ColdScene_files" folder, bucket is used as
an id for a tile where the scene is loaded so it is possible to prioritise
some tiles over other ones based on where the player is located, priority=0
will place requests in the front of the queue, any observers there might be
on the scene's events, parent to load under and if should be loaded invisible or not)

Asynchronous loading:
---------------------
Use: SceneManager.Get().LoadSceneAsync(string bucketId, float priority, string name, double limit,
IScenePartObserver[] observers, Transform parent, bool makeInvisible)

where 'limit' is a processing time duration in milliseconds per frame.
ColdScene loads/unloads tiny scene parts until it has used the 'limit' time duration.

***Remark***
When building standalone apps remember to manually copy
the "ColdScene_files" folder containing the asset bundles of your
scenes into the data folder of the standalone build
(the subfolder of the build's .exe file called "<app-name>_data").

Synchronous unloading:
----------------------
Use SceneManager.Get().UnloadScene(string bucketId, float priority, string name,
IScenePartObserver[] observers, Transform parent)

Asynchronous unloading:
-----------------------
Use SceneManager.Get().UnloadSceneAsync(string bucketId, float priority, string name,
double limit, IScenePartObserver[] observers, Transform parent)

where 'limit' is a processing time duration in milliseconds per frame.
ColdScene loads/unloads tiny scene parts until it has used the 'limit' time duration.

How do I add prioritized monobehaviour events?
--------------------------------------------------
1. Add a 'PrioritizedEventFeederComponent' component to any game object in your scene
which will never be destroyed during the life of the game
2. Add a 'EventPriorityComponent' component to those game objects which have
components you want prioritized monobehaviour events for
3. Fill the 'ComponentEventPriorities' list out with component reference and needed
component event priorities (must be larger than zero to be used, smallest priorities
will be called first). For example:

You have made a component called 'MyPrioritizedComponent' and you have
added it to a game object called 'MyGameObject'. You have then added
the 'EventPriorityComponent' component to 'MyGameObject'. You then
add a new element to the 'ComponentEventPriorities', drag and drop
the 'MyPrioritizedComponent' to the reference field and set the
priorities to whatever you want.

**Remark**
Components you want to use the prioritized events must implement the
IPrioritizedMonoBehavior interface

How do I use the LOD system?
--------------------------------------------------
1. Add the LodManager component to a game object in the scene (only uses prioritized events)
2. Add LodInterestArea component to the camera or the player object. Only Lod items which are inside
the interest area will be updated
3. Add LodItem components in scene where you want lod objects to be (only uses prioritized events)
4. Fill the 'LodStates' list out path to the ColdScene scenes of the Lod (relative to the ColdScene_files folder)
and their distances. Lowest quality should be first in the list (and with longest distance).
The MinDistance is the closest distance the interest area can be the lod item before it goes into another
lod state. The geometry scenes will be loaded under game object of LodItem component and therefore the
geometry scene position will be relative to this game object's position

Can I obtain the source code of what is inside the .dll file?
--------------------------------------------------
Yes, you most likely can. Write an email to tech@apex.dk asking for it and
why you are interested in it, then we will get back to you.

How do I run the demo?
--------------------------------------------------
1. Click 'Load'
2. Click 'Update lod'
3. Click 'Create player'
4. Run around with normal unity third person controls

What is known to work (tested in 3.3.0f4):
--------------------------------------------------
- Game Object/Transform hierarchy
- Transform component data
- Textures references: Movie textures, 2d textures
- Quaternion fields
- Vector3, Vector2 fields
- Arrays
- Generic lists
- float, int, bool fields
- Color fields
- Rect fields
- Custom monobehaviour components
- Reference to other object/component
- Animation component and AnimationClip references
- Material references
- Mesh references
- Light components (except following properties: CookieSize,
ActuallyLightmapped, DrawHalo, Lightmapping, ShadowSamples
ShadowRadius, ShadowAngle, IndirectIntensity)
- Audio source components and AudioClip references
- Prefab references (only reference to the root object at the moment)
- Terrain components and reference (except following properties: LightmapSize,
DrawTreesAndFoliage, CreateTreeColliders)
- Asset dependencies between two different scenes
- Cloth components
- Audio reverb zone components
- Wind zone components
- Camera components (except: Flare Layer can't be added)
- Remembers if game objects were inactive when saved
- Text Mesh (except following properties: OffsetZ, CharacterSize, LineSpacing,
Anchor, Alignment, TabSize)
- Font references
- GUISkin references

原文地址:http://forum.unity3d.com/threads/85600-ColdScene-SceneXML-for-Unity-3
What is known not to work:
--------------------------------------------------
- Layer masks
- Particle systems
- Doesnt work in Unity 2.x
分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2024-11-11 17:41 , Processed in 0.397414 second(s), 31 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部