00 Introduction

Introduction

What is this book?

The core idea of this book is to teach Unity as a tool for creative people of all kinds. This is a “living” book. Meaning things will change, parts will grow, others will wither. This is for multiple reasons. For one, I am not an expert on all topics Unity. I guess one can’t be. I have a background in Media-Design and am merely trying to learn and – in this case – teach Unity to the best of my ability. Thus, if you find errors, tell me and I will try to fix them. Also, Unity and its programming language C# are living things. Unity releases new versions twice a year and if you count in betas and package updates, then a lot of change is happening all the time. So best practices can change and I will do my best to maintain these changes in this book. As of now, all of this will be up-to-date with the Unity 2019.4 LTS (long-term support) version. In the beginning of this book I will teach Unity and C# using “creative coding” or “Generative Design”. I will start with coding, because no matter what you want to do with Unity, the sooner you become familiar with the coding bits, the easier everything else will be. While Unity has many uses (see below) most of them will require you to know many aspects of the software. So while a simple game like “Block Breaker” or “Asteroids” may not be too hard to clone, you have to deal with several aspects when putting it all together. User Input, Graphics, User Interface, Sound, etc.. While “Creative Coding” can get very complex, we can isolate ideas and try to be creative with them in isolation. This helps to build mileage coding and gives us the opportunity to take a step back and think about our visual output.
With “Creative Coding” we will look at the things you would see from people learning or using Processing. While Processing is great and I encourage anyone to look into it, Unity gives us more possibilities in the long run. While Processing relies on programming for creating output, we will also make use of other tools Unity provides.

Who is this for?

In this book I will assume that you have no knowledge of game engines, 3D or programming. If you do, try to start at a point that seems to be the end of your current knowledge.
Working with game engines often requires you to have access to 3D models which are created in other software. I can’t go over showing you how to create them in this book, but will provide you all the models you need to follow the book.

What is “Creative Coding”?

Creative Coding is a somewhat weird term. As programming is problem solving, any coding requires creativity. Whether in the finance industries, industry automation, gaming or innovative Artificial intelligence projects. Yet “Creative Coding” is widely adopted as a term for artworks created through code. These can range from simpler “sketches” that play with geometric shapes and mathematic patterns to fully fledged art installations using A.I. systems. As mentioned before, we will stretch this term a little and will not exclusively rely on code to create our works, but will also use the editor tools. The most well-known tools for Creative Coding are Processing and OpenFrameworks.

“Why Unity?”

While Unity is not optimized for Creative Coding, and learning to code for Unity might be harder than learning “Processing”, most ideas are the same. And while Unity will introduce more “clutter” into the journey to programming it enables its users to do so much more. It includes a full-featured 3D Engine and even AI Tools. But even more: C# - The programming language used to code - is very, very versatile. With it you can write native applications for Windows, Linux and Mac and Apps for iOS or Android. I think Unity is a great place to learn to code.

How to read this book

While reading fiction is very much straight forward, reading books that aim to teach something, can be challenging. I’d encourage you to read through each chapter as a whole and try to understand the concept that is discussed. Then go over it again and try it out yourself. But everyone is different, so you need to do what works best for you.
While I suggest reading the first ten chapters in order, you can take more freedoms after that. If the following chapter refer to things that you are missing just go ahead and read up on it. The later chapter are much more Unity focused and thus way easier to jump between.

Exercises and Projects

Throughout this book we will approach programming through examples as well as tiny projects to test and apply your knowledge.
The idea behind projects is: Programming is a craft. Many ideas are easy to grasp while reading them, but actually applying them is something different. There is a kind of muscle memory you have to build up. If you have to think about how to write an “if-block”, you lose time to actually think about the higher-level problem. Thus use these exercises to get up to speed with programming and just try to explore creative ways to build with code.

With all of this out of the way. Let’s go! I hope you enjoy the ride!