For some time, Unity has been issuing exams that cover a range of different skills for people who are either graduates, self-taught, or are classed as veterans in their field.
If we check the prerequisites on Unity's website (https://unity.com/products/unity-certifications/professional-programmer), they tell us that this exam isn't for absolute beginners and you need at least 2 years of experience working with Unity and computer programming, including C#. This book will take you through the process of becoming as familiar as possible with Unity and its services, to the point where it might feel like a beginners' course; however, I expect you to know the fundamentals of C# programming, such as what an
if statement is, what a function does, and what a class represents. If you don't, I would recommend reading Harrison Ferrone's Learning C# by Developing Games with Unity 2020 book first (https://www.packtpub...
Check out the following video to see the Code in Action: https://bit.ly/3klZRqf.
The six core objectives
The exam will mainly focus on scripting and the use of Unity's Application Programming Interface (API), Animation Controller, particles, rendering, and more. The whole idea is to get you familiar with what Unity has to offer you as a programmer. Unity has categorized their exam into core sections, which is a nice way of separating the workload for the exam.
The six core objectives are as follows:
- Programming core interactions
- Working in the art pipeline
- Developing application systems
- Programming for scene and environment design
- Optimizing performance and platforms
- Working in professional software development teams
Programming core interactions
When we load up our first blank scene in Unity, we will be controlling objects (or, as Unity likes to call them, game objects), moving, rotating, and/or expanding them. Not only can you adjust or transform these game objects,...
Overview of design patterns
At the beginning of this book, I mentioned that I will cover as much of Unity as possible, even though it is expected that you have been using Unity for at least 2 years before taking the exam. With regard to the fundamentals of programming, we will obviously be applying C# code. So, I expect that you are familiar with things such as functions, methods,
if statements, classes, inheritance, polymorphism, and so on. I will explain what I'm doing and what you should be doing for each bit of code I present, but I won't be going through the basics of each segment of code.
Design patterns are typical solutions to problems you are likely going to come across, and if you have a pattern that can solve a problem, then you should use it. Creating applications yourself, with your own workflow is great, but if you can explain an issue to another programmer using design pattern terms, it shows that you know what you are talking about and if they are a...
The SOLID principles
When you are planning and coding your projects within Unity as an Object-Oriented Programming (OOP) practitioner—programming that is based on objects containing data—patterns are a great way of making things uniform, saving time, and, hopefully, relating to other programmers who share the same patterns with you.
However, you won't always have a design pattern for all of your projects and it may not be practical to try and force plans that simply aren't practical. If we brush the design patterns to one side, there is an even deeper methodology to programming—the SOLID principles. These principles are guidelines that remind OOP programmers what they should be thinking about when coding projects. They outline what you should and shouldn't be doing with your code. Yes, you could ignore the SOLID principles, and even ignore design patterns, but difficulties will occur and increase the risk of you coding yourself into a dead end...
Designing the Killer Wave game
This will be our prototype/demo for a futuristic classic side-scrolling shooter, where we get to power up the ship and destroy the enemies that come at the player in a killer wave! We have spoken about design patterns and solid principles, and we are going to examine them in more detail, including all of the six core objectives for the Unity programmer exam. We will go through structuring the game, breaking it up into a framework of segments. We need to understand the relationship between each class and know how to expand our code without it upsetting what we've already written.
We will cover particle effects with an environment of stars whizzing past and ship thrusters with multiple particle colors. We will animate enemy ships and use Unity's own API to animate our environment scene. The list is quite long, but if we go through this project, we will not only be ready to tackle the Unity programmer exam, but we will also be ready to expand...
The Killer Wave game framework
We now roughly know what type of game we're going to make. Don't worry too much about the exact details as it will not affect the development phase. Our main focus will be the framework of the game; we'll focus on cosmetics in a later chapter.
It's very easy to jump into game development and make it up as you go along—sometimes, that's half of the fun. But when it comes to the fundamentals of creating any application, we need to know where to throw our creativity and logic by sticking to a particular development process. Ideally, you need a framework.
Before I carry on presuming you know what a framework is, let's just consider it as an overall blueprint—a plan of how all our pieces of code are going to talk to each other. Frameworks are similar to design patterns—the plan of the code is set out and ideally shouldn't be expanded on because we're sticking to a plan.
Yes, we know some...
Setting up Unity
Unity typically brings out a new version of their software every 2 weeks. You might expect this to cause problems with keeping up to date with the latest version for the exam. To date, Unity doesn't update their exams annually, so the exam and our project relate to Unity 2020 LTS. Unity will always keep updating and introducing new components and features with their future releases, but the prime fundamentals should remain the same.
This book is designed for users who have been using Unity for at least 2 years, so I'll assume you at least have a free account with them, and a copy of Unity installed. If not, here is the license activation guide from their 2020 LTS documentation: https://docs.unity3d.com/2020.2/Documentation/Manual/LicensesAndActivation.html.
Once you have created a free account, you can download the Unity Hub. This will hold a reference to the version of Unity you have installed and also your projects.
In this chapter, you were introduced to the six core objectives of the exam. You may have skipped on to the final mock exam and scored well, and you may want to increase your score and carry on with the project that we are gearing ourselves up for. With regards to the project, we have an idea of a few design patterns that we can implement as the project goes on (such as Singleton for manager scripts) and these patterns will be built within the game framework. We know what the SOLID principles are, and we mustn't forget them as our project expands.
In the next chapter, we are going to start setting up our camera and light in the
testLevel scene. We'll also bring in our player ship and hook it up with some controls so that we can move and shoot bullets. The first enemy will be imported with its own wave attack pattern. We will also be looking into what scriptable objects are and how they can benefit programmers and designers.