# CopyObjectAddressToPtr(object, void*)

> Assigns an object reference to a struct or pinned class.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Collections.LowLevel.Unsafe](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe.md)
* **Assembly:** UnityEngine.ManagedKernelModule

## CopyObjectAddressToPtr(Object, void\*)

> **Warning:**
>
> **Deprecated.** The garbage collector cannot track object references stored in unmanaged memory, leading to undefined behavior.

```csharp
public static void CopyObjectAddressToPtr(object target, void* dstPtr)
```

### Parameters

**** (\[Object]\(https\://learn.microsoft.com/dotnet/api/system.object)): **** (\[void\*]\(https\://learn.microsoft.com/dotnet/api/system.void)):&#x20;

### Remarks

Additional Resources: [UnsafeUtility.PinGCObjectAndGetAddress](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe/unsafeutility/pingcobjectandgetaddress.md)
