Unity adds friend League stats (Android and iOS supported)

Source: Internet
Author: User

(1) First of all, to apply for registration of a developer account on the Friends Alliance website (if not). Link address: http://www.umeng.com then go to your Account Personal Admin Center page, click on the "Add App" button, if you have not yet applied for your app project Appkey ( Note: Friends of the league for each of your apps to assign a unique identifier, And if an item is to be published on a different platform (such as iOS or Android), you will need to apply for separate appkey for this app separately.

(2) Download the latest game analysis statistics SDK from official website

The steps are: Home---"Product---" u-game (Basic version)---"Unity3d---"Analytics SDK View Integration Document---"In the top right corner of the SDK download---" Game statistics analysis---"top right corner SDK download---" Download Umenggameanalytics_v2.3.unitypackage Import to Unity project.

Import Step: Right-click Assets---"Import package---" Custom package

(3) Add code: If you want to learn more about the scripting features of the AU analytics stats, readers can do their own research. For quick use, the reader can attach the UmengManager.cs script directly to the object that has been activated in the scene, such as the first scene.

//
UmengManager.cs
//
Created by Zhucong on 1/1/14.
Copyright umeng.com. All rights reserved.
Version 1.31

Using Unityengine;
Using System.Collections;
Using Umeng;
public class Umengmanager:monobehaviour
{
static string Appkey;

void Awake ()
{
Dontdestroyonload (Transform.gameobject);
}
Use this for initialization
void Start ()
{
#if unity_android
Import app key logo app (Android)
Appkey = "$$$$$$$$$$$$$$$$$$$$$$$";
#elif Unity_iphone
Import App key identity app (iOS)
Appkey = "$$$$$$$$$$$$$$$$$$$$$$$";
#endif

Set Umeng Appkey
Ga. Startwithappkeyandchannelid (Appkey, "App Store");

Set to False when log publishing is turned on while debugging
Ga. Setlogenabled (FALSE);

Trigger Statistics event Start level
Ga. Startlevel ("your level ID");
}

Update is called once per frame
void Update ()
{
if (Input.getkeydown (Keycode.escape))
{
End Program
Ga. Finishlevel ("your level ID");
Application.Quit ();
}
}
#if unity_android

void Onapplicationpause (bool ispause)
{

Debug.Log ("Umeng:onapplicationpause" + ispause);
if (ispause) {
Debug.Log ("Umeng:----OnPause");
Ga.onpause ();
}
else{
Debug.Log ("Umeng:----Onresume");
Ga.onresume ();
}
}
void Onapplicationquit ()
{
Debug.Log ("Umeng:onapplicationquit");
Ga.onkillprocess ();
}
#endif
}
(4) Precautions:

① above theyour level ID一般是刚进入应用的第一个场景的名字,确保用户只要下载打开应用就能被统计到;

② when importing a downloaded package in a unity project, a file with the same name in the project will be overwritten, so make sure you don't have the same name, don't be sure to test it first, and I'm covered with the Android manifest file;

③ View statistics Path: Home---Personal center---u-game Basic Edition (view report).

Unity adds friend League stats (Android and iOS supported)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.