> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SetName

> Associates a name with the device object. This name is for use in debug diagnostics and tools.

Associates a name with the device object.
This name is for use in debug diagnostics and tools.

## Syntax

```cpp theme={null}
HRESULT SetName(
    LPCWSTR Name
)
```

### Parameters

*Name \[in]*\
Type: **LPCWSTR**

A **NULL**-terminated **UNICODE** string that contains the name to associate with the device object.

### Return value

Type: HRESULT

This method returns one of the [Direct3D 12 Return Codes](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/d3d12-graphics-reference-returnvalues).

## Remarks

This method takes UNICODE names.

Note that this is simply a convenience wrapper around [ID3D12Object::SetPrivateData](/reference/graphics/d3d12/interfaces/id3d12object/methods/id3d12object_setprivatedata_public) with **WKPDID\_D3DDebugObjectNameW**.
Therefore names which are set with `SetName` can be retrieved with [ID3D12Object::GetPrivateData](/reference/graphics/d3d12/interfaces/id3d12object/methods/id3d12object_getprivatedata_public) with the same GUID.
Additionally, D3D12 supports narrow strings for names, using the **WKPDID\_D3DDebugObjectName** GUID directly instead.

## Requirements

**Header:** d3d12\_xs.h or d3d12\_x.h\
**Library:** d3d12\_xs.lib or d3d12\_x.lib\
**Supported Platforms**: XBOX Series consoles and XBOX One family

## See Also

[Direct3D 12 Programming Environment Setup](https://learn.microsoft.com/en-us/windows/desktop/direct3d12/directx-12-programming-environment-set-up)

[ID3D12Object](/reference/graphics/d3d12_xs/interfaces/ID3D12Object/id3d12object)


## Related topics

- [SetPrivateData](/reference/graphics/d3d12/interfaces/id3d12object/methods/id3d12object_setprivatedata_public.md)
- [XMemSetWin32HeapName](/reference/system/xmem/functions/xmemsetwin32heapname.md)
- [XFrontPanelSetDisplayName](/reference/devkit/xfrontpaneldisplay/functions/xfrontpanelsetdisplayname.md)
- [Create and reserve your game name](/publishing/game-publishing/concepts/name.md)
- [ObjectSet](/services/playfab/api-references/events/data-types/objectset.md)
