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