Scripting API

UnsafeUtility

static class in Unity.Collections.LowLevel.Unsafe · UnityEngine.CoreModule

34 of 40 of Unity's membersUnity's documentation
In Tassix

Raw memory and pointer helpers for native containers.

Methods 34

static void* AddressOf<T>(ref T output)
static int AlignOf<T>()

The alignment of T, as the runtime lays it out (the padding before a T after one byte).

static ref T ArrayElementAsRef<T>(void* ptr, int index)
static ref T As<U, T>(ref U from)
static T As<T>(object from)
static ref T AsRef<T>(void* ptr)
static void CopyObjectAddressToPtr(object target, void* dstPtr)
static void CopyPtrToStructure<T>(void* ptr, out T output)
static void CopyStructureToPtr<T>(ref T input, void* ptr)
static bool EnumEquals<T>(T lhs, T rhs)
static int EnumToInt<T>(T enumValue)
static void Free(void* memory, Allocator allocator)
static void FreeTracked(void* memory, Allocator allocator)
static int GetFieldOffset(FieldInfo field)
static bool IsBlittable<T>()
static bool IsBlittable(Type type)
static bool IsNativeContainerType<T>()
static bool IsUnmanaged<T>()
static bool IsUnmanaged(Type type)
static bool IsValidAllocator(Allocator allocator)
static void* Malloc(long size, int alignment, Allocator allocator)
static void* MallocTracked(long size, int alignment, Allocator allocator, int callstacksToSkip)
static void MemClear(void* destination, long size)
static int MemCmp(void* ptr1, void* ptr2, long size)
static void MemCpy(void* destination, void* source, long size)
static void MemCpyReplicate(void* destination, void* source, int size, int count)
static void MemCpyStride(void* destination, int destinationStride, void* source, int sourceStride, int elementSize, int count)
static void MemMove(void* destination, void* source, long size)
static void MemSet(void* destination, byte value, long size)
static void* PinGCArrayAndGetDataAddress(Array target, out ulong gcHandle)
static void* PinGCObjectAndGetAddress(object target, out ulong gcHandle)
static T ReadArrayElement<T>(void* source, int index)
static T ReadArrayElementWithStride<T>(void* source, int index, int stride)
static void ReleaseGCObject(ulong gcHandle)
static int SizeOf<T>()
static int SizeOf(Type type)
static void WriteArrayElement<T>(void* destination, int index, T value)
static void WriteArrayElementWithStride<T>(void* destination, int index, int stride, T value)

Not in Tassix yet 6

CheckForLeaks ForgiveLeaks GetLeakDetectionMode IsValidNativeContainerElementType MemSwap SetLeakDetectionMode