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

# PartyLocalUser::SetCustomContext

> 为此本地用户对象配置可选的自定义指针大小上下文值。

为此本地用户对象配置可选的自定义指针大小上下文值。

## Syntax

```cpp theme={null}
PartyError SetCustomContext(  
    void* customContext  
)  
```

### Parameters

**`customContext`**   void\*\
*optional*

要与玩家对象一起存储的任意指针大小值。

### Return value

PartyError

如果配置自定义上下文成功，则返回 `c_partyErrorSuccess`；否则返回错误代码。可通过 [PartyManager::GetErrorMessage()](/services/playfab/multiplayer/networking/reference/classes/PartyManager/methods/partymanager_geterrormessage) 检索错误代码的可读形式。

## Remarks

自定义上下文通常用作"快捷方式"，简化对与本地用户关联的本地、特定于标题的内存的访问，而无需映射查找。使用 [GetCustomContext()](/services/playfab/multiplayer/networking/reference/classes/PartyLocalUser/methods/partylocaluser_getcustomcontext) 方法检索该值。<br /><br /> 任何配置的值都被库视为不透明，并且仅在本地设备上有效；它不会通过网络传输。

## Requirements

**Header:** Party.h

## See also

[PartyLocalUser](/services/playfab/multiplayer/networking/reference/classes/PartyLocalUser/partylocaluser)\
[PartyLocalUser::GetCustomContext](/services/playfab/multiplayer/networking/reference/classes/PartyLocalUser/methods/partylocaluser_getcustomcontext)


## Related topics

- [PartyLocalUser::GetCustomContext](/zh-CN/services/playfab/multiplayer/networking/reference/classes/PartyLocalUser/methods/partylocaluser_getcustomcontext.md)
- [PartyXblChatUser::SetCustomContext](/zh-CN/services/playfab/multiplayer/networking/xblreference/classes/PartyXblChatUser/methods/partyxblchatuser_setcustomcontext.md)
- [PartyInvitation::SetCustomContext](/zh-CN/services/playfab/multiplayer/networking/reference/classes/PartyInvitation/methods/partyinvitation_setcustomcontext.md)
- [PartyNetwork::SetCustomContext](/zh-CN/services/playfab/multiplayer/networking/reference/classes/PartyNetwork/methods/partynetwork_setcustomcontext.md)
- [PartyDevice::SetCustomContext](/zh-CN/services/playfab/multiplayer/networking/reference/classes/PartyDevice/methods/partydevice_setcustomcontext.md)
