> ## 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.

# set_custom_user_context

> chat_user::set_custom_user_context

Sets the app's optional, private, custom pointer-sized context value for this user.

## Syntax

```cpp theme={null}
void set_custom_user_context(  
    void* customUserContext  
)  
```

### Parameters

*customUserContext*   \_In\_opt\_\
Type: void\*

An arbitrary, pointer-sized value to store for the `chat_user` object.

### Return value

Type: void

None.

## Remarks

This method sets the app's optional, private, custom pointer-sized context value for this [chat\_user](https://docs.xbox.com/reference/chat/gamechat2/classes/chat_user/chat_user.md) object. The custom user context is typically used as a "shortcut" that simplifies accessing local, app-specific memory associated with the user without requiring a mapping lookup. Use the [chat\_user::custom\_user\_context](https://docs.xbox.com/reference/chat/gamechat2/classes/chat_user/methods/chat_user_custom_user_context.md) method to retrieve the custom user context for a `chat_user` object.

The custom user context is treated as opaque by the Game Chat 2 library, and is only valid on the local device; it is not transmitted over the network.

## Requirements

**Header:** GameChat2.h

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## See also

[Intro to Game Chat 2](https://docs.xbox.com/services/xbox-services/multiplayer/chat/game-chat2/game-chat-2-intro.md)\
[chat\_user](https://docs.xbox.com/reference/chat/gamechat2/classes/chat_user/chat_user.md)


## Related topics

- [custom_user_context](https://docs.xbox.com/reference/chat/gamechat2/classes/chat_user/methods/chat_user_custom_user_context.md)
- [chat_user class](https://docs.xbox.com/reference/chat/gamechat2/classes/chat_user/chat_user.md)
- [PartyLocalUser::SetCustomContext](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/classes/PartyLocalUser/methods/partylocaluser_setcustomcontext.md)
- [PartyXblChatUser::SetCustomContext](https://docs.xbox.com/services/playfab/multiplayer/networking/xblreference/classes/PartyXblChatUser/methods/partyxblchatuser_setcustomcontext.md)
- [PartyLocalUser::GetCustomContext](https://docs.xbox.com/services/playfab/multiplayer/networking/reference/classes/PartyLocalUser/methods/partylocaluser_getcustomcontext.md)
