Reader small image

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

Product typeBook
Published inJun 2023
Reading LevelIntermediate
PublisherPackt
ISBN-139781804613726
Edition3rd Edition
Languages
Tools
Right arrow
Author (1)
John P. Doran
John P. Doran
author image
John P. Doran

John P. Doran is a passionate and seasoned Technical Game Designer, Software Engineer, and Author who is based in Incheon, South Korea. His passion for game development began at an early age. He later graduated from DigiPen Institute of Technology with a Bachelor of Science in Game Design. For over a decade, John has gained extensive hands-on expertise in game development working in various roles ranging from game designer to lead UI programmer working in teams consisting of just himself to over 70 people in student, mod, and professional game projects including working at LucasArts on Star Wars: 1313. Additionally, John has worked in game development education teaching in Singapore, South Korea, and the United States. To date, he has authored over 10 books pertaining to game development. John is currently a Technical Game Design Instructor at George Mason University Korea. Prior to his present ventures, he was an award-winning videographer.
Read more about John P. Doran

Right arrow

Preface

As a game developer, your goal is to reach your customers where they are, and with more and more people purchasing mobile devices every year, mobile is a crucial platform to consider. Luckily, Unity offers cross-platform capabilities, allowing you to write your game once and then port it to other consoles with minimal changes. However, developing for mobile devices also requires specific considerations and features, which is where Unity 2022 Mobile Game Development comes in.

In this book, we’ll guide you through the process of using Unity to create and deploy a mobile game to both iOS and Android. We’ll cover essential topics such as adding input for mobile devices, designing interfaces that adapt to various screen sizes, and exploring ways to monetize your game with Unity’s In-App Purchase (IAP) and advertisement systems. We’ll also discuss the importance of using notifications to retain users and share your game with the world using Twitter and Facebook’s SDKs.

Additionally, we’ll delve into Unity’s analytics system to optimize your game’s performance and provide insights into user behavior. You’ll also learn how to polish your game in various ways before publishing it on the Google Play and iOS app stores.

Lastly, we’ll cover the use of Unity’s AR Foundation framework, which enables you to create Augmented Reality (AR) apps that are future-proof and compatible with multiple devices.

By the end of this book, you’ll have a solid understanding of how to use Unity for mobile game development, including crucial features unique to mobile devices.

Who this book is for

If you’re a Unity game developer interested in building mobile games for iOS and Android, then this book is an ideal resource for you. Although prior knowledge of C# is helpful, it is not required. Whether you’re a seasoned developer or just starting out, the step-by-step guidance provided in this book will help you understand the unique features and considerations necessary for mobile game development using Unity.

What this book covers

Chapter 1, Building Your Game, introduces the basics of Unity game development by creating a simple project that will be modified throughout the book to incorporate mobile-specific features.

Chapter 2, Project Setup for Android and iOS Development, explains the process of configuring your development environment for deploying your game to both Android and iOS mobile devices.

Chapter 3, Mobile Input/Touch Controls, teaches you the fundamentals of mobile input, covering touch and gesture recognition, using the accelerometer, and accessing device information through the Touch class.

Chapter 4, Resolution-Independent UI, focuses on how to build resolution-independent UI elements, which are useful for all game projects that utilize different aspect ratios and resolutions.

Chapter 5, Advanced Mobile UI, builds upon the knowledge from the previous chapter, expanding to include mobile-specific aspects of working on a UI, such as requiring on-screen controls and adapting the UI to fit devices with notches.

Chapter 6, Implementing In-App Purchases, explains how to integrate Unity’s IAP system into our project, including the creation of both consumable and non-consumable IAPs.

Chapter 7, Advertising Using Unity Ads, covers the integration of Unity’s ad framework into our project and explores the creation of both simple and complex advertisements.

Chapter 8, Integrating Social Media into Our Project, shows how to integrate social media into your game by incorporating features such as sharing high scores on Twitter and using the Facebook SDK to log in and display a player’s name and profile picture.

Chapter 9, Keeping Players Involved with Notifications, demonstrates the integration of notifications into your game, including their setup, creating basic notifications, and customizing how they are presented.

Chapter 10, Using Unity Analytics, covers integrating Unity’s analytics tools into your game, including tracking custom events and using remote settings to modify gameplay without requiring players to redownload the game.

Chapter 11, Remote Config, will show just how easy it is to set up Unity’s Remote Config system, and how we can utilize it for a simple example by changing the difficulty of our game by changing the speed at which the player moves.

Chapter 12, Improving Game Feel, introduces the concept of “game feel” in game design and explores how to integrate tweening animations, materials, postprocessing effects, and particle effects to enhance the player experience.

Chapter 13, Building a Release Copy of Our Game, walks you through the steps required to build a release copy of your game for both iOS and Android devices.

Chapter 14, Submitting Games to App Stores, provides tips and tricks for submitting your game to the Google Play and iOS app stores.

Chapter 15, Augmented Reality, covers the process of adding AR to your game, including the setup, installation, and configuration of ARCore, ARKit, and AR Foundation, detecting surfaces in the real world, and interacting with the environment through spawning objects.

To get the most out of this book

Throughout this book, we will work within the Unity 3D game engine, which you can download from https://unity.com/download. The projects were created using Unity 2022.1.0b16, but minimal changes should be required if you’re using future versions of the engine. If there is a new version out and you would like to download the exact version used in this book, 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.

For the sake of simplicity, we will assume that you are working on a Windows-powered computer when developing for Android and a Macintosh computer when developing for iOS.

Software/hardware covered in the book

Operating system requirements

Unity 2022.1.0b16

Windows, macOS, or Linux

Unity Hub 3.3.1

Windows, macOS, or Linux

If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book’s GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.

Download the example code files

You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Unity-2022-Mobile-Game-Development-3rd-Edition. If there’s an update to the code, it will be updated in the GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots and diagrams used in this book. You can download it here: https://packt.link/6M4wR.

Conventions used

There are a number of text conventions used throughout this book.

Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: “This gives us the code needed – in particular, the GameNotificationManager class – to be added to our script.”

A block of code is set as follows:

public void ShowNotification(string title, string body,
                                DateTime deliveryTime)
{
    IGameNotification notification =
    notificationsManager.CreateNotification();
    if (notification != null)
    {
        notification.Title = title;
        notification.Body = body;
        notification.DeliveryTime = deliveryTime;
        notification.SmallIcon = "icon_0";
        notification.LargeIcon = "icon_1";
        notificationsManager.ScheduleNotification(notification);
    }
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

ShowNotification("Endless Runner", notifText, notifTime);
        // Example of cancelling a notification
        var id = ShowNotification("Test", "Should Not Happen", 
            notifTime);
        if(id.HasValue)
        {
            notificationsManager.CancelNotification(id.Value);
        }
        /* Cannot be added again until the user quits game */
        addedReminder = true;
    }
}

Any command-line input or output is written as follows:

$ mkdir css
$ cd css

Bold: Indicates a new term, an important word, or words that you see onscreen. For instance, words in menus or dialog boxes appear in bold. Here is an example: “Open the Project Settings menu by going to Edit | Project Settings.”

Tips or important notes

Appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, email us at customercare@packtpub.com and mention the book title in the subject of your message.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packt.com with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Share Your Thoughts

Once you’ve read Unity 2022 Mobile Game Development, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere?

Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily

Follow these simple steps to get the benefits:

  1. Scan the QR code or visit the link below

https://packt.link/free-ebook/9781804613726

  1. Submit your proof of purchase
  2. That’s it! We’ll send your free PDF and other benefits to your email directly
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 2023Publisher: PacktISBN-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.
undefined
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

Author (1)

author image
John P. Doran

John P. Doran is a passionate and seasoned Technical Game Designer, Software Engineer, and Author who is based in Incheon, South Korea. His passion for game development began at an early age. He later graduated from DigiPen Institute of Technology with a Bachelor of Science in Game Design. For over a decade, John has gained extensive hands-on expertise in game development working in various roles ranging from game designer to lead UI programmer working in teams consisting of just himself to over 70 people in student, mod, and professional game projects including working at LucasArts on Star Wars: 1313. Additionally, John has worked in game development education teaching in Singapore, South Korea, and the United States. To date, he has authored over 10 books pertaining to game development. John is currently a Technical Game Design Instructor at George Mason University Korea. Prior to his present ventures, he was an award-winning videographer.
Read more about John P. Doran