Struct JsonMigrationContext | Serialization | 1.4.3-preview
docs.unity3d.com
    Show / Hide Table of Contents

    Struct JsonMigrationContext

    A migration context used to deserialize and migrate types.

    Namespace: Unity.Serialization.Json.Adapters
    Syntax
    public struct JsonMigrationContext

    Fields

    SerializedObject

    The in-memory representation of the value being deserialized.

    Declaration
    public readonly SerializedObjectView SerializedObject
    Field Value
    Type Description
    SerializedObjectView

    SerializedType

    The serialized type as reported by the underlying stream. This can be used in contravariant migrations.

    Declaration
    public readonly Type SerializedType
    Field Value
    Type Description
    Type

    SerializedVersion

    The deserialized version of the type.

    Declaration
    public readonly int SerializedVersion
    Field Value
    Type Description
    Int32

    UserData

    The user data provided in deserialization parameters.

    Declaration
    public readonly object UserData
    Field Value
    Type Description
    Object

    Methods

    Read<TValue>()

    Reads the root object as the specified TValue type.

    Declaration
    public TValue Read<TValue>()
    Returns
    Type Description
    TValue

    A new instance of TValue initialized with data from the root object.

    Type Parameters
    Name Description
    TValue

    The value type.

    Read<TValue>(ref TValue, SerializedValueView)

    Reads the specified SerializedValueView in to the given reference.

    Declaration
    public void Read<TValue>(ref TValue value, SerializedValueView view)
    Parameters
    Type Name Description
    TValue value

    The existing reference to read in to.

    SerializedValueView view

    The serialized value.

    Type Parameters
    Name Description
    TValue

    The value type.

    Read<TValue>(String)

    Reads a top level member as the specified TValue type.

    Declaration
    public TValue Read<TValue>(string name)
    Parameters
    Type Name Description
    String name

    The top level member name.

    Returns
    Type Description
    TValue

    A new instance of TValue initialized with data from the view.

    Type Parameters
    Name Description
    TValue

    The value type.

    Read<TValue>(SerializedValueView)

    Reads the specified SerializedValueView as the specified TValue type.

    Declaration
    public TValue Read<TValue>(SerializedValueView view)
    Parameters
    Type Name Description
    SerializedValueView view

    The serialized object.

    Returns
    Type Description
    TValue

    A new instance of TValue initialized with data from the view.

    Type Parameters
    Name Description
    TValue

    The value type.

    TryRead<TValue>(out TValue)

    Reads the root object as the specified TValue type.

    Declaration
    public bool TryRead<TValue>(out TValue value)
    Parameters
    Type Name Description
    TValue value

    When this method returns, contains the deserialized value, if successful. otherwise the default value for the TValue.

    Returns
    Type Description
    Boolean true if the value was read successfully; otherwise, false
    Type Parameters
    Name Description
    TValue

    The value type.

    TryRead<TValue>(String, out TValue)

    Reads a top level member as the specified TValue type.

    Declaration
    public bool TryRead<TValue>(string name, out TValue value)
    Parameters
    Type Name Description
    String name

    The top level member name.

    TValue value

    When this method returns, contains the deserialized value, if successful. otherwise the default value for the TValue.

    Returns
    Type Description
    Boolean true if the value was read successfully; otherwise, false
    Type Parameters
    Name Description
    TValue

    The value type.

    TryRead<TValue>(SerializedObjectView, out TValue)

    Reads the specified SerializedValueView as the specified TValue type.

    Declaration
    public bool TryRead<TValue>(SerializedObjectView view, out TValue value)
    Parameters
    Type Name Description
    SerializedObjectView view

    The view to read.

    TValue value

    When this method returns, contains the deserialized value, if successful. otherwise the default value for the TValue.

    Returns
    Type Description
    Boolean true if the value was read successfully; otherwise, false
    Type Parameters
    Name Description
    TValue

    The value type.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023