How long have you been working in Unity? Are there simple changes that you could make to your work process to get the most out of your iterations? Whether you’re super experienced or just starting out in hyper-casual game development, taking the time to review your processes can be key to staying efficient and producing great results.
A team of our in-house Game Developers recently got together to discuss best practices when working on Unity game prototypes. The result? The Voodoo Dev Manual. Filled with simple tips and tricks to help you work as efficiently as possible and speed up your iterations, this brand new resource is now available for all partner studios on our exclusive e-learning platform.
The Voodoo Dev Manual
Here at Voodoo, we test hundreds of prototypes every year, working closely with studios from across the globe. Through our Publishing Platform and e-learning hub, we provide studios with insights and advice on how to make great games, with topics varying from product, ideation, and marketability. The Voodoo Dev Manual is a new addition to our platform, providing a more technical framework for studios. We’ve identified key tips and tricks to help save time on your iterations, improve game performance and KPI’s, especially when scaling your game, as well as increase efficiency as a team. With fourteen sections in total, covering project organisation, prefabs, references, and much more, this guide will give you a clear and successful basis for current and future prototypes, ultimately increasing your chances of being published.
Today, we’ve teamed up with Clément Dubois and Thibaud Friedrich, in-house Game Developers from our Game OPS team, to give you a sneak peek into what the Dev Manual has to offer. Let’s take a look at three tips on how to work as efficiently as possible on Unity.
Thibaud and Clément, in-house Game Developers and authors of the Voodoo Dev Manual.
Tip One: Storing your references
When working on a prototype, it’s super important to have a project code and structure that is as resilient as possible. One thing that can complicate your project and slow you down is references. The first thing to think about is how to store your references correctly, especially when you have data that you want to display in another object.
For example, if we want to display the elapsed time data in the user interface, we tend to bring a reference from another object to the UI in order to display the correct data. We’ve identified that people often use the method GameObject.Find() to do this; searching by name and updating the text with the object that they want to display. Using GameObject.Find() will work in this scenario, but there are more efficient ways of doing this that will save you time in the long run. One solution is to store your references before, in Awake, so that you can then use your reference to update anything quickly and efficiently.
If we take a look at the codes below, you’ll find the second one to be five times faster. Ultimately, if you’re going to use a reference extensively, it’s a great idea to store it, cache it, so that it won’t become too complex for you throughout your iterations.
Here's an example of a code that will work, but will slow you down considerably in the long run:
Here's an example of a code that's five times faster than the previous one!
Tip Two: Getting references
Storing your references is one quick tip to improve your performance, but getting references is also super important when it comes to stability. A good practice is to avoid direct references between objects, as these can break easily, especially when turning an object into a prefab, as you’re likely to lose all the hard references linked to it.
If we take a look at GameObject.Find() and Transform.GetChild(), often taken as the most convenient approach, we find that it’s dangerous to use these when getting references, as they are both name and hierarchy-dependent. If you have two objects with the same name, which is particularly risky for common names such as Canvas or GameObject.clone, and you swap their position, you may end up getting the wrong reference and find NullReferenceException all over the place. When working with other people, this can also become very confusing, as they might not be aware that you’re using this to get references.
The Voodoo Dev Manual contains several examples of how to get references in a more efficient way. One method is to assign the object or the component in the inspector, rather than using the previous methods. This is the most direct reference you can have, and will prevent them from breaking easily.
To illustrate, in the example below, we can create a script called the UI Header, which will go under the UI header object. This means that there’s a strong link between the two, and will be even safer if the UI Header is a prefab. When you share your project with other developers via Git, for example, you’ll be sharing the prefab directly, and it will automatically share the reference too, creating a strong and autonomous UI Header.
Here's an example of a code that's ideal for your UI Header:
Tip Three: Creating a convenient UI
The first two points on references are simple and straightforward tips on how to maximise your team’s efficiency when working on Unity game prototypes. We’re now going to check out a more complex example of what the Voodoo Dev Manual has to offer, focusing on the User Interface.
When approaching your User Interface, you want to organise it as much as possible from the get-go. This will help you be more efficient, work faster, and iterate more easily on your projects.
In the first example below, we can see a UI Manager that references 100% of your UI in a single canvas, with all elements put in a chaotic order inside. Your Manager, however, won’t be part of the canvas, and the properties won’t be part of the same prefab. Working in this way may function the first time, but will get super confusing and unstable after a few iterations, as you may lose elements that you remove or change in another prefab.
Our advice for creating an efficient and re-usable UI is to keep one UI Manager, but create it on the Game Object Canvases as displayed in the second picture below. Each view will take care of itself, with references of elements only inside their own prefab. This means you can change or remove each view easily, without creating a mass of information that is not linked together.
Once you’ve split your UI correctly, you will be able to create different canvases for the game view; one canvas for the win view, lose view, main menu view, and so on. This is also a structure that you can re-use on every prototype you work on, hence saving you a lot of time when testing! This is again important when working with more than one person on a project, as you can work on multiple views at the same time without creating conflict between changes made by other team members!
Here’s an example of a chaotic hierarchy that will become unstable the more you iterate:
Here’s an example of a clean hierarchy that will keep everything well organised and speed up your iterations:
So there were three of our tips on how to increase your efficiency when creating hyper-casual games in Unity. The full Dev Manual covers a vast array of topics, including scriptable objects, physics, how to use events, and much more. And this is just the beginning!
👉 If you’re already working with Voodoo, you can access the manual right here on our e-learning platform.
👉 If you want to access this exclusive resource, as well as a whole library of other useful tips and tricks to help your studio create hit games, submit your game with us today!
A big thank you to Clément Dubois and Thibaud Friedrich for their contribution to the Voodoo Dev Manual! You can also check out their live stream here to find out more about these tips, as well as a live Q&A on Unity Development.