One of the features I had never seen before Unity was a feature called Light Probes. These are represented by spheres in your scene, which sample the nearby light and project it onto dynamic objects as they move between them. So what are these things and why do we need them?
A few months back, while I was in the process of transitioning between jobs, I decided to start learning Unity in my free time. There are a lot of options when it comes to getting started in game development these days, and I was curious to find out first-hand what it would be like to start fresh in today’s world. To be fair, as a professional game designer with well over a decade of experience at studios large and small, and with a background in computer science, I can’t truly know how well a training program would work for someone…
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.
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.
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: https://docs.unity3d.com/Manual/LowLevelNativePluginProfiler.html
Scriptable Objects were a new concept to me as I started learning Unity. The basic idea is to create a standalone script independent of the scene, and which can’t be attached directly to any GameObject. Two main ways I’ve seen Scripted Objects used, are data persistence and templating.
Since Scripted Objects exist independent of any scene, you can use them to store data you’re going to need access to throughout your game. …
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.
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.
Delegates are generally considered an advanced topic in C#, but in actuality, they are really very simple. All a delegate does is allow a method to be used as a variable.
Already you can probably think of some interesting uses for delegates, but the reason they are an advanced topic is that they unlock a lot more than they appear to at first. As far as I have seen, the main usage for delegates seems to be events.
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.
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.
Assuming you’ve got the basics of playing prebaked animations down in Unity, one of the next things you’re almost certainly going to need is Inverse Kinematics. If you’re not familiar with the concept, what IK basically does is enable bones to move to points in space automatically, rather than having to explicitly define the movement of each bone.
To get started, install the Animation Rigging package in the Unity Package Manager. Once this is finished, you’ll want to define an IK target. This can be as simple as an empty game object, but will of course vary depending on your…
In programming there are is usually more than one way to solve a problem. Unity has an interesting opportunity space when it comes to components, and what each C# script is responsible for. Taking a look at something like health, it would be possible to create an interface that contains a health property and a damage method, which could be implemented by multiple entities. It would also be possible to create a health script and add it to each entity via a script component.
There really isn’t a best answer here, as far as I can tell. Interfaces are more…