public static Analytics.AnalyticsResult CustomEvent (string customEventName, IDictionary<string,object> eventData);

Parameters

customEventName自定义事件的名称。名称不能包含前缀“unity”- 这是一个保留关键字。
eventData触发自定义事件时发送至 Unity Analytics 的其他参数。字典键不能包含前缀“unity”- 这是一个保留关键字。

Description

自定义事件(可选)。

Unity Analytics allows you to track specific events within your game. By configuring a series of Custom Events within your game, you can create your own Funnel Analysis to observe your players' game behavior. Good places to put custom events include: milestones, new levels, Scene transitions, etc.

除了跟踪自定义事件以外,Unity Analytics 还允许您传入与事件相关的自定义维度(字典)。这些自定义维度主要用于了解实现自定义事件时用户的其他规格。

using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Analytics;

public class GameLoginMonoBehaviour : MonoBehaviour { public void OnGameOver() { int totalPotions = 5; int totalCoins = 100; Analytics.CustomEvent("gameOver", new Dictionary<string, object> { { "potions", totalPotions }, { "coins", totalCoins } }); } }

public static Analytics.AnalyticsResult CustomEvent (string customEventName);

Description

自定义事件(可选)。

using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Analytics;

public class GameLoginMonoBehaviour : MonoBehaviour { public void OnGameOver() { Analytics.CustomEvent("gameOver"); } }

public static Analytics.AnalyticsResult CustomEvent (string customEventName, Vector3 position);

Description

自定义事件(可选)。

using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Analytics;

public class GameLoginMonoBehaviour : MonoBehaviour { public void OnGameOver(Vector3 v) { Analytics.CustomEvent("gameOver", v); } }