Share the combined effect of AVOS cloud and unity

Source: Internet
Author: User

Abstract: As more and more developers useUnity3dDevelopers must write back-end services on their own. To help developers solve all backend concerns, make up your services, we have found the AVOS cloud unity SDK. This article will explain it in detail.AVOS cloudAnd unity.

If you want to rewrite a game with unity, but want to implement the following functions:

* Record the time when the user opens the game

* Record the duration of each game

* Record the number of times a user clicks a screen in each Board

* Records the total number of games a user has played before each game is closed.

* Record scores obtained by each bureau

Based on these data, game developers can effectively track users' rigid needs based on statistical information. The launch of AVOS cloud statistics analysis mobile client can meet users' needs, view the statistics of game development using unity.

The following is an example of how to easily meet the above five requirements using the AVOS cloud ~

Initialize SDK

Developers can download the code of the copupa/flappy_bird project.
1. Open one. unity under the flappy_bird-master \ assets \ scenes directory (of course, you must install unity before conducting the tutorial ).
2. Then, follow the AVOS cloud unity Quick Start to gradually import the unity SDK. (This step is important for subsequent tutorials)
3. Make sure that the appid and appkey are correct.

Function implementation

Record the time when a user opens the game

I'm glad to tell you that as long as the "Data Statistics" feature is enabled on the AVOS cloud site, the game is recorded when it is opened, and will be sent to the server according to the set policy, so the first function has been completed at the SDK level. How is it? Is it very sexy?

Record the duration of each game
1. Find assets/scripts/gamemanager. CS and double-click it to open it in the compiler. The author uses Microsoft VISAUL studio 2013 as the unity auxiliary development tool.

2. Make the code in the update method as follows:

Switch to bird. CS and add the method for ending the onegame Custom Event:

The preceding two statements complete a custom event record on the client. In this way, the statistics of this event can be viewed in the background of the AVOS cloud site.

Record the number of times a user clicks a screen in each Board

Similarly, in bird. CS, you can add the following line of code in the 32-row Update () method:

Records the total number of games a user has played before each game is closed.

Switch back to gamemanager. CS and add a static attribute for it to record the total number of games played by players in a session.

Then change the update () method to the following:

Only two more statements are used to complete this function.

The following information is about how to record the scores obtained from each sentence. Click here >>> to view the remaining full text.

Share the combined effect of AVOS cloud and unity

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.