class in UnityEngine.Analytics
/
Implemented in:UnityEngine.UnityAnalyticsModule
Provides access to the Analytics session information for the current game instance.
This class contains static methods for looking up Analytics session information. Note that cumulative statistics are reset if the player re-installs the game.
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Analytics; using System;
public class NewBehaviourScript : MonoBehaviour { void Start() { Debug.Log("Start " + AnalyticsSessionInfo.userId + " " + AnalyticsSessionInfo.sessionState + " " + AnalyticsSessionInfo.sessionId + " " + AnalyticsSessionInfo.sessionElapsedTime); AnalyticsSessionInfo.sessionStateChanged += OnSessionStateChanged; }
void OnSessionStateChanged(AnalyticsSessionState sessionState, long sessionId, long sessionElapsedTime, bool sessionChanged) { Debug.Log("Call " + AnalyticsSessionInfo.userId + " " + sessionState + " " + sessionId + " " + sessionElapsedTime + " " + sessionChanged); } }
sessionCount | The number of sessions played since the app was installed. |
sessionElapsedTime | The time elapsed, in milliseconds, since the beginning of the current game session. |
sessionFirstRun | Reports whether the current session is the first session since the player installed the game or application. |
sessionId | A random, unique GUID identifying the current game or app session. |
sessionState | The current state of the session. |
userId | A random GUID uniquely identifying sessions played on the same instance of your game or app. |
sessionStateChanged | Dispatched when the Analytics session state changes. |
SessionStateChanged | Dispatched when the Analytics session state changes. |