AnalyticsSessionInfo

class in UnityEngine.Analytics

/

Implemented in:UnityEngine.UnityAnalyticsModule

Description

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); } }

Static Properties

sessionCountThe number of sessions played since the app was installed.
sessionElapsedTimeThe time elapsed, in milliseconds, since the beginning of the current game session.
sessionFirstRunReports whether the current session is the first session since the player installed the game or application.
sessionIdA random, unique GUID identifying the current game or app session.
sessionStateThe current state of the session.
userIdA random GUID uniquely identifying sessions played on the same instance of your game or app.

Events

sessionStateChangedDispatched when the Analytics session state changes.

Delegates

SessionStateChangedDispatched when the Analytics session state changes.

对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961