Unity Mobile Game Development: Saving Data and Highscores

In this Unity tutorial, we'll learn how to save data between play sessions with PlayerPrefs and create a highscore level for deployment to iOS or Android. Software required: Unity 3.4.
Course info
Level
Intermediate
Updated
Jan 2, 2012
Duration
3h 35m
Table of contents
Introduction and Project Overview
Unity Mobile Game Development: Saving Data and Highscores
Examining Our Start Scene and the Scripts That Are Included 4m Consulting Our Game Design Document to Begin Our Script 6m Using a GUI.Box Function to Draw Our First Highscore 6m Using a Vector2 to Offset Our Text Placement for Control 5m Automatically Centering Our Text Using Our Location Class 10m Creating a New GUI Style to Format Our Text 6m Using a Built-in Array to Store Multiple Pieces of Data 8m Displaying Our Entire Array Using a for Loop 7m Adding a Height Offset to Display All Our Names 8m Refactoring Our Arrays into a Class for Easier Organization 9m Displaying Our Highscore Array Correctly Over Our Graphics 8m Saving Game Data Using PlayerPrefs to Store Information 8m Creating a Testing Interface to Set PlayerPrefs Data 7m Synchronizing Our PlayerPrefs with Our Local Highscore Class 12m Synchronizing Our Rounds and Kills Data 6m Scripting an Add New Highscore Function 10m Testing if We Need to Create a New Highscore 4m Moving Our Highscores Down Using a Reverse for Loop 11m Inserting Our Highscores into Our Data Correctly 6m Letting the Player Enter Their Name Using a GUI.TextField 9m Using GUI.color to Change Our Highscore Text Colors 6m Creating Flashing Text Using Mathf.PingPong and GUI.color 6m Testing Our Highscore Display Script to Find Bugs 11m Tracking Game IDs to Make Sure We Don't Duplicate Data 11m Changing the Location of Our Game Id Check to Remove Bugs 8m Using the iPhoneKeyboard Class to Get User Input on Android 6m Saving the PlayerPrefs Data to Disk in Case Our Game Crashes 4m Using the PreviewLabs PlayerPrefs Plugin for Speed on Mobile 7m Examining the Final Game Code in Reference to the Highscore System 4m
Description
Course info
Level
Intermediate
Updated
Jan 2, 2012
Duration
3h 35m
Description

In this Unity tutorial, we'll learn how to save data between play sessions with PlayerPrefs and create a highscore level for deployment to iOS or Android. Through these lessons, we'll learn how we can use the GUI class to draw various text and images on our screen. From there, we will examine time-saving techniques for placing our GUI elements with the inspector accurately. We'll learn how we can use arrays to store multiple pieces of data and how we can display lists using for loops. Then we'll re-factor our array into a highscore class. With our display set up, we will learn the commands to access our PlayerPrefs and the logic we need to sort and store our data. Finally, we'll see how we can use mobile keyboards and examine a faster method of saving data for mobile platforms. From basic preferences like display settings to more complex structures like high scores, it's important to understand how to save data after we close our game. Software required: Unity 3.4.

About the author
About the author

Chris is a VFX author at Pluralsight. Along with creating and recording training, he also manages the support team and works closely with the production development team. He began his career working freelance and quickly realized that he wanted to find a company where he could use his talents to help people succeed in the CG industry.

More from the author
Artist Guide to Motion Graphics in 3ds Max
Intermediate
3h 37m
Sep 30, 2013
Artist's Guide to Smoke 2013
Beginner
1h 53m
Feb 4, 2013
Tips and Tricks in Smoke
Intermediate
32m
Feb 2, 2013
More courses by Chris Glick