{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Method AllocatePayloadBuffer | Unity Logging | 1.1.0-pre.3
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method AllocatePayloadBuffer

    AllocatePayloadBuffer(uint)

    Allocates a new Payload buffer from the default Payload container.

    Declaration
    public PayloadHandle AllocatePayloadBuffer(uint payloadSize)
    Parameters
    Type Name Description
    uint payloadSize

    Number of bytes to allocate; must fall within the range of MinimumPayloadSize and MaximumPayloadSize.

    Returns
    Type Description
    PayloadHandle

    A valid PayloadHandle if successful.

    AllocatePayloadBuffer(uint, out NativeArray<byte>)

    Allocates a new Payload buffer from the default Payload container.

    Declaration
    public PayloadHandle AllocatePayloadBuffer(uint payloadSize, out NativeArray<byte> buffer)
    Parameters
    Type Name Description
    uint payloadSize

    Number of bytes to allocate; must fall within the range of MinimumPayloadSize and MaximumPayloadSize.

    NativeArray<byte> buffer

    NativeArray that allows safe access to the allocated Payload buffer

    Returns
    Type Description
    PayloadHandle

    A valid PayloadHandle if successful.

    Remarks

    If successful a PayloadHandle referencing the allocated memory is returned, and a NativeArray with read/write access (as a view into the buffer) is passed out. If allocation fails an invalid handle and buffer are returned.

    The PayloadHandle must be saved, as it's needed to retrieve the payload buffer again and also to release it. However, the passed out NativeArray is only intended for immediate reading/writing into the buffer; the variable must not be saved.

    IMPORTANT: The Payload buffer must eventually be released by calling ReleasePayloadBuffer(PayloadHandle, out PayloadReleaseResult, bool) Failure to do so will cause a "leak" in the Payload container.

    NOTE: Do not call Dispose on the returned NativeArray; it's only a view into the Payload buffer.

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)