Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Unity 2022 Mobile Game Development - Third Edition

You're reading from  Unity 2022 Mobile Game Development - Third Edition

Product type Book
Published in Jun 2023
Publisher Packt
ISBN-13 9781804613726
Pages 480 pages
Edition 3rd Edition
Languages
Author (1):
John P. Doran John P. Doran
Profile icon John P. Doran

Table of Contents (21) Chapters

Preface 1. Part 1: Gameplay/Development Setup
2. Chapter 1: Building Your Game 3. Chapter 2: Project Setup for Android and iOS Development 4. Part 2: Mobile-Specific Features
5. Chapter 3: Mobile Input/Touch Controls 6. Chapter 4: Resolution-Independent UI 7. Chapter 5: Advanced Mobile UI 8. Chapter 6: Implementing In-App Purchases 9. Chapter 7: Advertising Using Unity Ads 10. Chapter 8: Integrating Social Media into Our Project 11. Part 3: Game Feel/Polish
12. Chapter 9: Keeping Players Involved with Notifications 13. Chapter 10: Using Unity Analytics 14. Chapter 11: Remote Config 15. Chapter 12: Improving Game Feel 16. Chapter 13: Building a Release Copy of Our Game 17. Chapter 14: Submitting Games to App Stores 18. Chapter 15: Augmented Reality 19. Index 20. Other Books You May Enjoy

Improving Game Feel

We now have a basic game, but it’s just that... basic. In this chapter, you will learn some of the secrets of game developers to take the basic prototype of their game and turn it into something with a lot of polish that feels satisfying to play, which is known as improving the game feel of the project.

Also known as juiciness, or making our games juicy, in some corners of the game industry, game feel is a kind of catch-all term for all the things that we do in a game to make it pleasing for its users to interact with. This is something that is done with most mobile games that are out there today, and lacking this kind of interactivity will make others believe our project is lacking in polish.

In this chapter, you will learn some of the different ways that you can integrate several of these features into your projects. We will start off by learning how to make use of animations. We will then see how we can use Unity’s material system in order...

Technical requirements

This book utilizes Unity 2022.1.0b16 and Unity Hub 3.3.1, but the steps should work with minimal changes in future versions of the editor. If you would like to download the exact version used in this book, and there is a new version out, you can visit Unity’s download archive at https://unity3d.com/get-unity/download/archive. You can also find the system requirements for Unity at https://docs.unity3d.com/2022.1/Documentation/Manual/system-requirements.html in the Unity Editor system requirements section. To deploy your project, you will need an Android or iOS device.

You can find the code files present in this chapter on GitHub at https://github.com/PacktPublishing/Unity-2022-Mobile-Game-Development-3rd-Edition/tree/main/Chapter12.

Animation using LeanTween

Currently, our game’s menus are completely static. This is functional but does not make players excited about playing our game. To make the game seem more alive, we should animate our menus. Being able to use Unity’s built-in animation system is great, and it can be quite useful if you want to modify many different properties at once. If you don’t need precise control, say, if you’re only modifying a single property or you want to animate something purely via code, you can also make use of a tweening library.

Tweening, short for “in-betweening,” is a common technique used in animation and game development to create smooth transitions between two states or values over a specified duration. It involves interpolating or transitioning a property or set of properties from one value to another gradually.

If it is given a start and an end, the library will take care of all the work in the middle to get that property...

Adding tweens to the pause menu

Now that we have finished the main menu, let’s continue adding tweens to the pause menu:

  1. Go ahead and open up our Gameplay scene. Update the PauseScreenBehaviour script to have the following implementation of SetPauseMenu:
    /// <summary>
        /// Will turn our pause menu on or off
        /// </summary>
        /// <param name="isPaused">is the game currently
        /// paused</param>
        public void SetPauseMenu(bool isPaused)
        {
            paused = isPaused;
            /* If the game is paused, timeScale is 0,
               otherwise 1 */
            Time.timeScale = (paused) ? 0 : 1;
            ...

Working with materials

Previously, we have always used the default material for everything in our project. This has worked out well for us, but it may be a good idea for us to talk a little bit about creating custom ones to improve the visuals of our player. Materials are instructions on how to draw 3D objects within Unity. They consist of a shader and properties that the shader uses. A shader is a script that instructs the material on how to draw things on the object.

Shaders are a huge subject that entire books have been written on, so we can’t dive too much into them here, but we can talk about working with one that is included in Unity, the Standard Shader. Implement the following steps:

  1. First, open the Gameplay scene. Then, let’s create a new folder in the Project window called Materials:
Figure 12.7: Adding Materials

Figure 12.7: Adding Materials

  1. Open up the Materials folder we just created, and then once inside, create a new material by right...

Using postprocessing effects

One of the ways that we can improve the visual quality of our game with little effort is by using postprocessing effects (previously called Image Effects). Postprocessing is the process of applying filters and other effects to what the camera will draw (the image buffer) before it is displayed on screen.

Unity includes a number of effects in its freely available postprocessing stack. Unity’s postprocessing stack is a set of visual effects that can be applied to the rendered images in a game or application to enhance the overall visual quality. These effects can include things like color grading, depth of field, motion blur, ambient occlusion, and more. By using the postprocessing stack, developers can easily add these effects to their games without having to create them from scratch.

The term “stack” is used to emphasize that these effects are designed to be used together, in a layered manner, to achieve a desired visual style...

Adding particle effects

Typically used for effects that are natural or organic, such as fire, smoke, and sparks, particle systems create objects that are designed to be as low cost as possible, called particles. Due to this, we can spawn many of the particles at once with a minimal performance cost. One of the easiest types of particle systems to create is a trail to follow our player, so let’s add one of those now using the following steps:

  1. Select Player in the Hierarchy window, and then right-click and select Effects | Particle System.

This will make this system a child of the player, which will be good for what we are going to do.

  1. In the Particle System component, change Start Speed to 0 and Simulation Space to World. Then, change Start Color to a color that stands out, such as purple.
  2. Open up the Shape section by clicking on it. Change Shape to Sphere and set Radius to 0 (it will automatically change to 0.0001).

This is a step in the right...

Summary

We have now improved our game by a huge amount by only doing a few simple things. We first animated our menus with a few lines of code using tweens from LeanTween and saw how a few lines of code can improve the visual quality of our UI in a number of ways. We next saw how to create materials to improve the visual quality of our ball and then used some postprocessing effects to polish the contents of our screen. Finally, we discussed how to use particle effects to create a nice trail following our player.

With these concepts, you now have the skills to dramatically improve the feel of your game projects so that players actually enjoy interacting with your game.

By this point, our game is finally ready for the big leagues. In the next chapter, we will explore how to build our games in order to get our game onto the Apple App Store and Google Play.

lock icon The rest of the chapter is locked
You have been reading a chapter from
Unity 2022 Mobile Game Development - Third Edition
Published in: Jun 2023 Publisher: Packt ISBN-13: 9781804613726
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}