RSX Code Reference
    Preparing search index...
    • rsx
    • SerializationUtility

    Class SerializationUtility

    The SerializationUtility class provides utility methods dealing with object serialization and diff generation.

    Another way to create serialized object representations is using the SerializedObject.

    Index
    • Gets the missing serialization information for the specified object.

      Parameters

      • object: object

      Returns { className: string; namespace: string }

      The information, or null, if the object does not carry serialization information.

    • Acquires the missing type information from source into the target object. This also removes the references from the source object.

      Type Parameters

      • T

      Parameters

      • object: object

        The target object to inject the missing type information to.

      Returns SerializedObject

      target

    • Acquires the missing type information from source object.

      Parameters

      • source: object

        The object to source the missing type information from.

      Returns { data: SerializedObject; typeName: string; typeNamespace: string }

      Type information about the missing type.

    • Clones the specified object. Non-serializable types and fields are ignored in clone. A deep copy is performed on all serializable elements except for resources or game objects.

      Type Parameters

      • T

      Parameters

      • original: T

        Non-null reference to the object to clone. Object type must be serializable.

      Returns T

      Deep copy of the original object.

    • Compares the specified objects using their serialization data. Non-serializable types and fields are ignored in compare. A deep compare is performed on all serializable elements except for resources or game objects.

      Parameters

      • a: any

        A reference to the first object to be compared. Object type must be serializable.

      • b: any

        A reference to the second object to be compared. Object type must be serializable.

      Returns boolean

      True if both objects contain the same data; false otherwise.

    • Compares the specified scene objects using their serialization data. A deep compare is performed on all serializable elements of the scene objects, it's children and components.

      Parameters

      • a: SceneObject

        A reference to the first scene object to be compared.

      • b: SceneObject

        A reference to the second scene object to be compared.

      Returns boolean

      True if both objects contain the same data; false otherwise.

    • Creates an empty instance of the specified type.

      Type Parameters

      • T

        Type of the object to create. Must be serializable.

      Parameters

      Returns T

      New instance of the specified type, or null if the type is not serializable.

    • Deserializes a binary byte array into a concrete TypeScript object.

      Type Parameters

      • T

      Parameters

      • type: ClassOf<T>

        The type of object to be deserialized.

      • data: number[]

        The binary data that represents the object.

      • Optionalmanager: SceneNodeManager

        Optional scene node manager to resolve scene object handles during deserialization.

      Returns T

      A newly created instance with the contents of data deserialized or null.

    • Deserializes a datastream into a concrete TypeScript object.

      Type Parameters

      • T

      Parameters

      • type: ClassOf<T>

        The type of object to be deserialized.

      • dataStream: DataStream

        The stream that contains the object at the current cursor position.

      • Optionalmanager: SceneNodeManager

        Optional scene node manager to resolve scene object handles during deserialization.

      Returns T

      A newly created instance with the contents of dataStream deserialized or null.

      The stream position is not modified, if you need to seek to 0, it must be done before the call.

    • Determines if the object has it's type information missing.

      Parameters

      • object: object

        The object to test for missing type.

      Returns object is MissingSerializationType

      True if the object is an object whose type information was missing at deserialization time.

    • Prunes (removes) the missing serialization type data from the specified object.

      Parameters

      • object: object

        The object that contains missing serialization type data.

      • recursive: boolean

        True to descent into the object tree and prune recursively.

      Returns void

    • Serializes an object into a binary byte array. This array can be deserialized using deserialize.

      Parameters

      • instance: any

        The object to be serialized into a binary byte array.

      Returns number[]

      A byte array that contains a binary representation of instance.

    • Serializes an object into a datastream. The datastream can be deserialized using deserialize.

      Parameters

      • instance: any

        The object to be serialized into the dataStream.

      • dataStream: DataStream

        The stream to serialize the object into.

      Returns number

      The number of bytes written into the dataStream, or null on failure.

    • Transfers the missing type information from source into the target object. This also removes the references from the source object.

      After transfer, the source will have its missing data fields removed, and they will be transferred to target.

      Type Parameters

      • T extends object

      Parameters

      • target: T

        The target object to inject the missing type information to.

      • source: object

        The object to source the missing type information from.

      Returns T & Partial<MissingSerializationType>

      target