Class SerializationMetadata
Used to store state related to deserialization
Namespace: Unity.RuntimeSceneSerialization
Syntax
public class SerializationMetadata
Constructors
SerializationMetadata(AssetPack)
Create a new SerializationMetadata object for use in scene object serialization or deserialization
Declaration
public SerializationMetadata(AssetPack assetPack = null)
Parameters
Type | Name | Description |
---|---|---|
AssetPack | assetPack | The AssetPack to use for asset references |
Fields
InvalidID
Fixed ID for an invalid object
Declaration
public const int InvalidID = -1
Field Value
Type | Description |
---|---|
Int32 |
Properties
AssetPack
The AssetPack used to track asset references
Declaration
public AssetPack AssetPack { get; }
Property Value
Type | Description |
---|---|
AssetPack |
Methods
AddToMetadataRecursively(GameObject)
Track metadata for this object, its components, and its children and their components
Declaration
public void AddToMetadataRecursively(GameObject gameObject)
Parameters
Type | Name | Description |
---|---|---|
GameObject | gameObject | The GameObject to be tracked |
DoPostSerializationActions()
Dequeue and Invoke all actions in the PostSerializationAction queue
Declaration
public void DoPostSerializationActions()
GetAssetMetadata(Object, out String, out Int64)
Get the guid and fileId from the AssetPack for a UnityObject if it is an asset
Declaration
public void GetAssetMetadata(Object unityObject, out string guid, out long fileId)
Parameters
Type | Name | Description |
---|---|---|
Object | unityObject | The object whose metadata to get |
String | guid | The guid of the object, if it is an asset tracked by the AssetPack |
Int64 | fileId | The fileId of the object, if it is an asset tracked by the AssetPack |
GetSceneID(Object)
Get the metadata id for a scene object
Declaration
public int GetSceneID(Object sceneObject)
Parameters
Type | Name | Description |
---|---|---|
Object | sceneObject | The scene object whose id will be returned |
Returns
Type | Description |
---|---|
Int32 | The id of the given scene object, if it is tracked in this metadata object |
GetSceneObject(Int32)
Get a scene object by its metadata id (not InstanceID)
Declaration
public Object GetSceneObject(int sceneID)
Parameters
Type | Name | Description |
---|---|---|
Int32 | sceneID | The metadata id of the desired scene object |
Returns
Type | Description |
---|---|
Object | The scene object for the given id, if it exists |
PrintSceneObjectList()
Return a string which summarizes the state of the scene object metadata
Declaration
public string PrintSceneObjectList()
Returns
Type | Description |
---|---|
String |
SetupSceneObjectMetadata(List<GameObject>)
Set up metadata for the first time on a list of scene roots This is the only thing that can cause IsSetup to be true. Some warnings are suppressed while IsSetup is false
Declaration
public void SetupSceneObjectMetadata(List<GameObject> roots)
Parameters
Type | Name | Description |
---|---|---|
List<GameObject> | roots | List of scene roots for which to add metadata |