Note: Gaming Services Analytics is now available as a preview package. Gaming Services Analytics is an improved offering that allows you to easily understand game performance and player behaviors so you can make strategic decisions. See the documentation.
为了维持高效且响应迅速的服务,Analytics 会对游戏或应用程序的特定实例可发送的标准和自定义事件 (Standard and Custom Events) 数量施加限制。这些限制包括:
All of the AnalyticsEvent functions that send events, return a value from the AnalyticsResult enumeration. If an application exceeds one of the limits, the AnalyticsResult
value identifies the specific error encountered:
AnalyticsResult |
超出的限制 |
---|---|
AnalyticsResult.TooManyRequests |
每小时 100 个事件 |
AnalyticsResult.TooManyItems |
每个事件 10 个参数 |
AnalyticsResult.SizeLimitReached |
数据 500 字节或事件名称 100 个字符 |
注意:每个实例 100 个事件的限制是适合大多数 Unity Analytics 用户的默认值。如果您的游戏或应用程序需要更高的事件限制,请与 Analytics 支持团队联系以制定出符合您要求的限制。
在单个自定义事件或标准事件中,最多可以发送 500 个字符或字节的数据。此限制计算了所有参数名称的组合字符串长度以及参数值的以下大小(取决于数据类型):
C# 数据类型 | Size |
---|---|
byte、ubyte | 1 |
short、ushort | 4(转换为 int) |
Int、uint | 4 |
long、ulong | 8 |
float | 8(转换为 double) |
double | 8 |
decimal | 8(转换为 double) |
string | 字符串长度 |
object | 调用 ToString() 后的字符串长度 |
例如,以下事件使用 67 个字节/字符的数据长度限制:
Dictionary<string, object> data = new Dictionary<string, object>();
data.Add("int_param", 32); // 9 个字符 + 4 个字节
data.Add("bool_param", true); // 10 个字符 + 1 个字节
data.Add("float_param", 3.3f); // 11 个字符 + 8 个字节
data.Add("string_param", "String value"); // 12 个字符 + 12 个字符
AnalyticsResult result = AnalyticsEvent.Custom("custom_event", data);
当您发送定义自身必需参数或可选参数的标准事件时,必需参数的名称和值的长度以及所有可选参数的长度都包含在 500 字节限制中,还包括所有自定义数据。
事件本身的名称长度不能超过 100 个字符,但此长度不计入事件数据的 500 字节限制。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.