文档

​
​

Development

User Acquisition

Monetization

工业

Vivox Unity SDK

Vivox Unity SDK

Vivox
​
​
Vivox Unity SDK
  • Overview
  • Get started
  • Release notes
  • Developer guide
    • Set up your project
    • Create voice and text channels
    • Messaging
      • Channel messages
      • Message metadata
      • Chat history
        • Chat History query options
      • Edit and delete messages
      • Directed messages
      • Offline direct messages
      • Anti-flooding
      • Large text channel setting
      • Retrieve Conversations list
      • Set Chat Markers
    • Player management
    • Device management
    • Audio management
    • Mobile development
    • Text-to-speech
    • Speech-to-text
    • Real-time recording
    • Server-side-recording
    • Troubleshooting
  • Tutorials
  • Reference
  1. Vivox Unity SDK 文档

聊天历史记录

Retrieve and manage chat message history.
阅读时间1 分钟
最后更新于 8 个月前

频道文本消息历史记录

Vivox 允许用户使用
VivoxService.Instance.GetChannelTextMessageHistoryAsync(string channelName, int requestSize = 10, ChatHistoryQueryOptions chatHistoryQueryOptions = null)
访问频道文本活动的历史记录,其中
channelName
是要请求相应历史记录的频道的名称,
requestSize
是最多要返回的消息数(默认值为 10),
chatHistoryQueryOptions
是一个可选参数,可以执行多种操作,例如指定消息中包含的单词或短语、消息的特定 PlayerId 发送方,或前后查询时间。如需了解有关
ChatHistoryQueryOption
s 的更多具体信息,请参阅 聊天历史记录查询选项。
IReadOnlyCollection
中返回的消息按从最新消息到最旧消息的顺序列出。
注意
聊天历史记录保存 7 天。如果正在使用文本证据管理,聊天历史记录的保存期限将延长至 30 天。
以下代码片段的示例说明如何从设置的 LobbyChannelName 中提取最近 25 条消息,然后按从旧到新的顺序记录发送方的显示名称和消息,而无需使用可选的 ChatHistoryQueryOptions。
public async void FetchHistoryAsync(){ var historyMessages = await VivoxService.Instance.GetChannelTextMessageHistoryAsync(LobbyChannelName, 10); //Reversing the messages so they display from oldest to newest var reversedMessages = historyMessages.Reverse(); foreach(VivoxMessage message in reversedMessages) { Debug.Log($"{message.SenderDisplayName}: {message.MessageText}"); }}

Copyright © 2026 Unity Technologies
法律信息隐私政策CookiesDocumentation Terms of Use请勿出售或分享我的个人信息您的隐私选择(Cookie 设置)

“Unity”、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属公司在美国和其他地方的商标或注册商标(此处查看更多信息)。其他名称或品牌是其各自所有者的商标。

为方便起见,一些页面是机器翻译的,可能包含不准确的内容。如有信息不一致的情况,以英文版本为准。

  • 在本页上
    • 频道文本消息历史记录


报告此页面的问题