⬆️ ⬇️

Developing a game for Android on Unity 5. From idea to monetization (Live)

Hi Habr. I want to share my experience in the development of a quiz game on Unity 5 version. I note that a similar game was already released by me in 2014 and scored 7800 downloads. Due to the terrible implementation, the game earned 80% of deletions and the project was abandoned. Let's try to start the game on a new one, correcting the mistakes of the predecessor.



The article will consider such topics as:



  1. Idea of ​​the game
  2. Project structure
  3. Features of game logic and methods of implementation
  4. Implementation of monetization tools in app purchase and the official AdMob plugin
  5. Promotion


Idea of ​​the game



The idea of ​​the game is simple. We encrypt popular songs as emoji emoticons and offer the user to decrypt.

')

image




At the time of publication, there are no similar Russian-language games on Google Play.



Project structure



When developing on Unity, I do not use patterns, but I try to separate the logic from the display.







The Display (Canvas) game object is the parent element of the UI, and the class for accessing the entire UI, GameDisplay, hangs on it. The entire interface is located in the parent Display (Canvas) and, if necessary, we refer to the UI elements through the GameDisplay class.



To handle the interaction with the UI, I create an empty Handlers game object and place the class (s) on it that contains methods for handling button presses.



For convenience of grouping, we put all this in an empty game UI object (it is not interface elements and is not displayed).



GameDisplay class example
public class GameDisplay : MonoBehaviour { public GameObject LevelNumText; public GameObject InputField; public static GameObject StaticInputField, StaticAlertsText; public GameObject AlertsText; float AlertHideTimer = 4f; void Awake() { //     UI  static    StaticInputField = InputField; StaticAlertsText = AlertsText; } 




Handler class example:
 namespace NavigationHandlers { public class NavigationHandlers : MonoBehaviour { public void LoadHowToPlayScene() { SceneManager.LoadScene(1); } public void StartGame() { SceneManager.LoadScene(2); } public void BackToMainMenu() { SceneManager.LoadScene(0); } } } 




The Levels object contains our Level_ (num) levels. As you can see from the screenshot, the Level_1 UI element contains the grid layout group component. In Level_1 are placed child Image elements that display smiles and are grouped in the grid thanks to the parent component.



Features of game logic and data storage



To save slightly the amount of game data (account \ player name, etc.) I use PlayerPrefs wrapped for convenience in the DB class.



DB class example:
 public class Db : MonoBehaviour { public static List<string> answers = new List<string>(); public static void SaveDb() { PlayerPrefs.Save(); } public static int CurrentLevel { get { return PlayerPrefs.GetInt("CurrentLevel"); } set { PlayerPrefs.SetInt("CurrentLevel", value); } } 




With the help of this, we are able to conveniently access the DB Db.CurrentLevel = Db.CurrentLevel + 1;



The logic of the game is not complicated and consists of a single Game class. All levels ( have a Level tag ) are activated by default. Our task is to find and disable, with the exception of the current CurrentLevel.



 //      Levels = GameObject.FindGameObjectsWithTag("Level"); //   foreach (GameObject Level in Levels) { //        if (Level.gameObject.name != "Level_" + Db.CurrentLevel + "") { Level.gameObject.SetActive(false); } //    else { Level.gameObject.SetActive(true); } } 


Implementation of monetization tools in app purchase and the official AdMob plugin



I used to use "self-made" tools for the Admob service and in-game purchases. Now Unity and Google provide great \ convenient \ simple plug-ins from the box. The plugin for advertising can be downloaded here , and for in app purchase in Unity → Services itself. I downloaded, downloaded everything into the project and used it. Official examples and documentation are excellent.



Promotion



I used to use services for cheating fives \ downloads \ comments of advertmobile and apptools . I highly recommend not using these tools. The guys from the beaver corporation have worked hard, the worn reviews are deleted \ not displayed.



The game is in GP the fifth day, statistics on downloads: 228/459 (+1 game purchase). In adMob 5900 hits and 6 $ of income. We received 231 deletions, there is work to do. Perhaps the quality is lame, or the game did not meet the expectations. According to the leaderboard, the game is played, people write me an email and ask for hints.



To promote using thematic forums, VC groups, blog articles, groups in telegrams, Habrahabr . Will I be able to gain 7800 downloads as in the previous version, or did the GP for indie become incomprehensible? The answer to this question and, if necessary, the need for a more detailed analysis of logic next time.

Source: https://habr.com/ru/post/317236/



All Articles