I’m being battered and getting knackered with my schedule at the moment, not to mention work decided it’s a good month to “ramp up” but I’m coping. Still, I found time to have a look at one of PacktPubs newest titles and rather surprisingly it’s a video book. So sit back relax, get your favourite 3D glasses on and have a look.
OK, it’s not in 3D but I had you going there. Scripting is just one of those things you have to do for any Unity3D title, don’t let all the shiny editor features or artful animation state diagrams or tree’s fool you. in order to really make a game and make it shine you are going to need to code, so let’s see what this book/video has to offer.
Almost every tutorial, article or post about Unity usually involves navigating through menus or creating assets / art to get in to your game and only when you have all the bits in place does it cover scripting, almost as an afterthought in most cases. In fact Unity3D does show its colours a bit when you look through their scripting tutorials, in most cases they are written for someone who has never coded before, further identifying their target market at the jazzy designers out there who want to showcase their art in a 3D setting. Unity3D does a lot to help you in the UI area and in fact does fantastic feats in the UI and under the covers to make it practical and useful.
At its core though, in order to move beyond just bumping things together with physics and beyond just looking pretty you need to script and attach those scripts in a meaningful way to your game objects.
This is where this video book leans in quietly, taps you on the shoulder and leads you down the dark path of creating scripts to both help and amaze you, basically to show you how to make the most out of all the under the cover properties, events and goings on in the Unity3D engine and then actually do something with them.
By the end of this book you should be able to make scrolling backgrounds, clever AI for bad guys and be able to save / load and change levels in the way Unity3D always wanted you to but forgot to mention.
Here’s a brief run through what all the chapters are and what to expect from them. Each video covers one chapter each in roughly 15 minute chunks and are also broken up in to specific sections within the chapter, this provides a nice easy breakdown for each subject. To follow along, there is an additional code bundle provide with the book so you can either read the code or pause and create it yourself. The chapters are as follows:
Chapter 1 “Creating a Background Audio Controller”
Audio is something usually overlooked by most tutorials and the presenter does a good job walking through creating some scripts for player audio interactions to trigger and manage audio as it affects the player.
Chapter 2 “Incorporating Sound Effects”
Extending on from the previous chapter, here we look more at environmental effects, 3D audio and managing how the environment can react to a player’s involvement in the scene. A nice trick is also show for correctly managing audio levels.
Chapter 3 “How to make 2D Parallax Backgrounds”
If you have wondered how easy it would be to create a simple 2D scrolling platform game then here the presenter walks you through setting up a simple 2D environment, then extending it from both the player and the scenes perspective. It then steps it up a notch to create some faux real effects to make your environment come alive.
Chapter 4 “How to make 3D Parallax Backgrounds”
Reminiscent of other side scrolling 3d Jump games, this chapter walks you through setting up a basic scene with 3D obstacles and world, then it progresses to script it up so you can control the player effectively and work with real time physics while the player moves through the level. This shows crucial elements for how to transform restricted 3D elements and then extends the control for other behaviours such as jumping.
Chapter 5 “Creating an Enemy Character Controller”
This chapter is slightly different from the previous chapters where you are walked through the scripts necessary to do some state based animation controllers, the difference is that it’s not until the nd when you finally apply the scripts to a model do you see the results of your efforts and with the model provided in the pack the results are nice. however as this is a scripting tutorial, these are script animations and don’t use the new mechanim features, in some cases it’s easier to use these low level animations rather than having to wade through defining all the state paths needed for mechanim to work. Your choice, sledgehammer (quick) or finesse.
Chapter 6 “Creating Enemy AI”
Extending on the mechanisms used to create Enemy AI systems, the author introduces several more patterns including turret “look at” (for tower defence style AI), patrol patterns and then adding state logic to change enemy behaviour based on scene inputs.
Chapter 7 “Creating Level Changing Systems”
Any game which has several worlds or levels needs to be able to transition between them, in Unity3D multiple levels are represented by using multiple scenes. So in this chapter the presenter walks you through several of the most common patterns for switching between levels, through collision (entering a portal / door), via menus (remembering even Menus are scenes).
What i found nice about this chapter is that you are also shown when things go wrong and build settings configuration for levels
Chapter 6 “Creating an Item Carry-Over System”
To finish off this video book the presenter walks through an important system that is needed when you have multiple scenes in your game, the ability to take stuff with you, this can be as simple as objects a player is carrying, or just the players current health or weapon. Basically any situation where you need to keep score as the player progresses.
Unity has a system for doing this using a manager called “PlayerPrefs”, the chapter walks through using this feature to pass data between scenes.
I’m not really a video tutorial person, I usually prefer the written word with pictures (pop up characters also help) but I found this video series very easy to pick up and run with. Each chapter and section provide distinct tutorials on a subject and are complete so you are not left wanting between chapters. The author does explain each bit he uses and rounds up each video to ensure you caught the key points. Sometimes you do feel you are repeating things a fair bit (especially n the first two chapters on audio) but this just ensures you understand how things are managed by Unity3D and how to use then right.
- Videos are in small enough chunks to be able to be picked up any time, usually a few minutes each and are complete
- Presenter speaks with a constant level voice and is very easy to listen to
- The presentation of the videos is very nice, lots of explanation around each video and section
- At times I would have liked to hear some passion in the presenters voice, sometimes it’s a little too sombre.
- Would have like to have seen more. What is there is very detailed and complete but left me wanting yet more advanced scripts
- More of a Unity Scripting Cookbook than a Mastering Unity Scripting but still very good info.
I will say that you should make sure you have some coffee to hand whilst watching the videos, the monotone presentation can make you drop off. I jest but it is probably a good thing, as it ensures you get the information clearly and don’t get annoyed by a cheery person.
There were quite a few good scripts to pick up from this series but more than that you get the author telling why things work well when done a certain way and is essential to learn how to script in the way that Unity3D expects and will actually work well with.
I would have liked to see a bit more in there and a few more scenarios but what is there is explained very well, well done Kyle.