Version: 2017.3
导入 SDK
附加游戏脚本

创建游戏脚本

通过创建脚本启动玩家会话

在 Unity Editor 中,通过转至 Assets > Create > C# Script 来新建 C# 脚本 将新建脚本命名为:__UnityAnalyticsIntegration__(命名必须准确才能使脚本正常运行)

打开脚本并复制代码

Double-click on the script to open your script in MonoDevelop. Completely replace the default generated code with the code below and click “Save” in MonoDevelop. The Unity Project ID that you see in the sample code below is unique to your game. It is used to link your Editor project to your Analytics dashboard.

转至 Analytics Dashboard 查看唯一的功能性项目 ID

using UnityEngine;
using System.Collections;
using UnityEngine.Cloud.Analytics;

public class UnityAnalyticsIntegration : MonoBehaviour {

    // 此函数用于初始化
    void Start () {

        const string projectId = "SAMPLE-UNITY-PROJECT-ID";
        UnityAnalytics.StartSDK (projectId);

    }

}
导入 SDK
附加游戏脚本
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961