docs.unity3d.com
    目次を表示する/隠す

    Class UnsafeUtilityExtensions

    Provides utility methods for unsafe, untyped buffers.

    Inheritance
    Object
    UnsafeUtilityExtensions
    Namespace: Unity.Collections.LowLevel.Unsafe
    Syntax
    public static class UnsafeUtilityExtensions

    Methods

    AddressOf<T>(in T)

    Returns the address of a read-only reference.

    Declaration
    public static void *AddressOf<T>(in T value)
        where T : struct
    Parameters
    Type Name Description
    T value

    A read-only reference.

    Returns
    Type Description
    Void*

    A pointer to the referenced value.

    Type Parameters
    Name Description
    T

    The type of referenced value.

    AsRef<T>(in T)

    Returns a read-write reference from a read-only reference. Useful when you want to pass an in arg (read-only reference) where a ref arg (read-write reference) is expected. Do not mutate the referenced value, as doing so may break the runtime's assumptions.

    Declaration
    public static ref T AsRef<T>(in T value)
        where T : struct
    Parameters
    Type Name Description
    T value

    A read-only reference.

    Returns
    Type Description
    T

    A read-write reference to the value referenced by item.

    Type Parameters
    Name Description
    T

    The type of referenced value.

    ReadArrayElementBoundsChecked<T>(Void*, Int32, Int32)

    Reads an element from a buffer after bounds checking.

    Declaration
    public static T ReadArrayElementBoundsChecked<T>(void *source, int index, int capacity)
    Parameters
    Type Name Description
    Void* source

    The buffer to read from.

    Int32 index

    The index of the element.

    Int32 capacity

    The buffer capacity (in number of elements). Used for the bounds checking.

    Returns
    Type Description
    T

    The element read from the buffer.

    Type Parameters
    Name Description
    T

    The type of element.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    Thrown if the index is out of bounds.

    WriteArrayElementBoundsChecked<T>(Void*, Int32, T, Int32)

    Writes an element to a buffer after bounds checking.

    Declaration
    public static void WriteArrayElementBoundsChecked<T>(void *destination, int index, T value, int capacity)
    Parameters
    Type Name Description
    Void* destination

    The buffer to write to.

    Int32 index

    The index at which to store the element.

    T value

    The value to write.

    Int32 capacity

    The buffer capacity (in number of elements). Used for the bounds checking.

    Type Parameters
    Name Description
    T

    The type of element.

    Exceptions
    Type Condition
    IndexOutOfRangeException

    Thrown if the index is out of bounds.

    トップに戻る
    Copyright © 2023 Unity Technologies — 商標と利用規約
    • 法律関連
    • プライバシーポリシー
    • クッキー
    • 私の個人情報を販売または共有しない
    • Your Privacy Choices (Cookie Settings)