Ben Pielstick

Understanding how your players are interacting with your game is critical to knowing where to make improvements. Unity provides a helpful set of analytics, which can help you get started monitoring player behaviour.

All you have to do is turn on analytics under Project Settings, and Unity gives you a dashboard

A dashboard isn’t all you need, however. You also have to install the analytics library and add using UnityEngine.Analytics to your scripts.

Performance should typically be your top concern whenever you are working on a game. While poor performance isn’t certain to cause your game to fail, it takes an overwhelmingly great experience in order for players to enjoy a game that doesn’t run well.

Fortunately with Unity, keeping track of your game’s performance is pretty easy. All you have to do is open up the built-in profiler, and you’ll have tons of performance data to look through.

So much information!

With the profiler open and your game running, you can watch your game’s performance in real-time. If you need to get even more specific, Unity offers more advanced features using the profiler API:

When you’re starting out with Unity, one of the things you’re almost certain to run into is race conditions. When you start up your game or load a new scene and everything starts up at once, you may have a hard time making sure things happen in a specific order. Callbacks are a great solution to this, assuming you’re already familiar with using delegates.

Set somethingIsDone as a callback method, which is passed as a parameter to doSomething, so that it can be called whenever the logic of doSomething is finished

As you can see, this is a very convenient way to enforce an order of operations, especially across multiple GameObjects which are all doing things at the same time. There are some even more advanced ways to streamline this code such as Actions and Lambda expressions, but these aren’t really necessary in order to start taking advantage of callbacks.

There are two main ways to save data in Unity. The first is using something called PlayerPrefs. This basic method allows the saving and loading of basic data types quickly and easily.

set to save, get to read, easy as can be

For anything more complicated, you’re going to have to assign the System.Serializable attribute to your data, and then decide what data format you want to use, and include the proper namespace in your project. Whether you want to write out binary files using something like System.Runtime.Serialization.Formatters, or JSON using UnityEngine.JSONSerializeModule. Depending on the format that you use the process of writing your file to disk might be a bit different, but Unity does throw in a helpful way of defining where in the file system your data goes.

Ben Pielstick

Ben Pielstick

Game developer with over 12 years of experience, mainly focused on MMOs.