Documentation

Unity Engine

Download Unity

Unity Engine

GetUnsafePtr()

Get a pointer to the data.
Read time 1 minuteLast updated 3 days ago

Definition

  • Type: Method
  • Namespace: Unity.Collections
  • Assembly: UnityEngine.ManagedKernelModule
public readonly T* GetUnsafePtr()

Returns

Type

Description

<T>*A pointer to the data.

Remarks

When container has safety checks enabled it performs a job safety check for write access.
WARNING: Not only does this method require you to managed lifetimes correctly, but also it is fundamentally not possible to use safely when the FixedList lives on a GC-managed object in CoreCLR. The parent object may move during a garbage collection, which will move the FixedList, and the pointer will be stale and potentially crash. Make sure that whenever you use this, the FixedList where you got it from is never living on a GC-managed object.