docs.unity3d.com
    Show / Hide Table of Contents

    Method Create

    Create(Void*, Int32)

    Creates a blob asset from a pointer to data and a specified size.

    Declaration
    public static BlobAssetReference<T> Create(void *ptr, int length)
    Parameters
    Type Name Description
    Void* ptr

    A pointer to the buffer containing the data to store in the blob asset.

    Int32 length

    The length of the buffer in bytes.

    Returns
    Type Description
    BlobAssetReference<T>

    A reference to newly created blob asset.

    Remarks

    The blob asset is created in unmanaged memory. Call Dispose() to free the asset memory when it is no longer needed. This function can only be used in an unsafe context.

    See Also
    BlobBuilder

    Create(Byte[])

    Creates a blob asset from a byte array.

    Declaration
    public static BlobAssetReference<T> Create(byte[] data)
    Parameters
    Type Name Description
    Byte[] data

    The byte array containing the data to store in the blob asset.

    Returns
    Type Description
    BlobAssetReference<T>

    A reference to newly created blob asset.

    Remarks

    The blob asset is created in unmanaged memory. Call Dispose() to free the asset memory when it is no longer needed. This function can only be used in an unsafe context.

    See Also
    BlobBuilder

    Create(T)

    Creates a blob asset from an instance of a struct.

    Declaration
    public static BlobAssetReference<T> Create(T value)
    Parameters
    Type Name Description
    T value

    An instance of T.

    Returns
    Type Description
    BlobAssetReference<T>

    A reference to newly created blob asset.

    Remarks

    The struct must only contain blittable fields (primitive types, fixed-length arrays, or other structs meeting these same criteria). The blob asset is created in unmanaged memory. Call Dispose() to free the asset memory when it is no longer needed. This function can only be used in an unsafe context.

    See Also
    BlobBuilder
    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