> ## Documentation Index
> Fetch the complete documentation index at: https://docs.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](https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12object/methods/id3d12object_setprivatedata_public.md) with **WKPDID\_D3DDebugObjectNameW**.
Therefore names which are set with `SetName` can be retrieved with [ID3D12Object::GetPrivateData](https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12object/methods/id3d12object_getprivatedata_public.md) 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](https://docs.xbox.com/reference/graphics/d3d12_xs/interfaces/ID3D12Object/id3d12object.md)


## Related topics

- [SetPrivateData](https://docs.xbox.com/reference/graphics/d3d12/interfaces/id3d12object/methods/id3d12object_setprivatedata_public.md)
- [Set Display Name](https://docs.xbox.com/services/playfab/api-references/rest/profiles/account-management/set-display-name.md)
- [XMemSetWin32HeapName](https://docs.xbox.com/reference/system/xmem/functions/xmemsetwin32heapname.md)
- [XFrontPanelSetDisplayName](https://docs.xbox.com/reference/devkit/xfrontpaneldisplay/functions/xfrontpanelsetdisplayname.md)
- [PFAccountManagementSetDisplayNameRequest](https://docs.xbox.com/services/playfab/api-references/c/pfaccountmanagementtypes/structs/pfaccountmanagementsetdisplaynamerequest.md)
