Emulating Palette Swapping In Unity

Emulating Palette Swapping In Unity

Turns out that doing true palette swapping in Unity is going to be a little bit difficult, so I came up with the next best thing, emulating it. Basically what I plan on doing is having multiple layers that make up each character. I’ve already created a system to sync up multiple GameObject animations to allow me to have separate animations for the body and legs, so all I need to do now is change the artwork to gray and add a Material with a tint to it. On top of this I’ll put a new layer representing the stuff that shouldn’t change color such as the skin and any extra details and then I’ll have more granular control over how to color the player, and other actors, in my game. Here is how I am testing it out in PhotoShop: Now I just need to implement this in...
Introduction to Unity

Introduction to Unity

This is an excerpt chapter from my Weekend Code Project: Unity’s New 2D Workflow book. I hope you enjoy this free content on how to use Unity’s new 2D features. If you like what you see, please pick up a copy of the book to get access to the artwork, source code and a PDF/ePub version of the book. Why Unity Right now, Unity is the de facto game development framework and IDE for a lot of the success stories you read about on multiple platforms. The IDE is very polished and easy to use. Previously, with Unity being a 3D tool meant there was a certain level of knowledge you needed before getting started. Now with the addition of an all-new 2D workflow, things have gotten a lot easier for game developers looking to build simple, non-3d games.  Unity supports three languages: Unity Script (which is similar to JS), C#, and Boo. Unity now has a free version that supports exporting to desktop and mobile but forces you to display the Unity logo when the game starts up. The Pro version gets pricey, but adds lots of must-have features for more advanced game developers. There are also additional licenses you can get that export to console, such as the Xbox, PlayStation, Wii U, and more, but those licenses cost even more. Unity has a Web Player that relies on a plugin, so while you can export your games to the Web, they won’t be playable on mobile browsers.  Over the next section, we will take a look at the IDE itself and how to navigate around it. There...
Introduction to C#

Introduction to C#

This is an excerpt chapter from my Weekend Code Project: Unity’s New 2D Workflow book. I hope you enjoy this free content on how to use Unity’s new 2D features. If you like what you see, please pick up a copy of the book to get access to the artwork, source code and a PDF/ePub version of the book. C# in Unity I am a big fan of C#, and while Unity Script is useful, eventually you will need a little more flexibility in your code, so I decided to focus on using C# for our game. Because of this, I wanted to do a quick primer on C#, scripting in Unity, and some of the more common APIs you will be using when we build our game. As we dig deeper into the code, you will need to pick an external editor since Unity doesn’t have one built in. By default, Unity ships with MonoBuilder, but you can just as easily switch it out for something a little more robust, such as Visual Studio if you are doing your development on Windows. Simply go into the Edit > Preferences menu and change the path to the external editor. Once you have picked an editor you like, you are ready to start coding. In this book, I will be showing the code from Visual Studio, but MonoDeveloper will work exactly the same on Windows and Mac. Data Structures C# is a strongly typed language and is very similar to Java or ActionScript 3. If you have some background in JavaScript, it should feel familiar as well. Let’s take a...
Building the Scene

Building the Scene

This is an excerpt chapter from my Weekend Code Project: Unity’s New 2D Workflow book. I hope you enjoy this free content on how to use Unity’s new 2D features. If you like what you see, please pick up a copy of the book to get access to the artwork, source code and a PDF/ePub version of the book. Creating Prefabs At this point, we have an animated sprite on the stage, but not much else. We are going to start creating reusable GameObjects called prefabs in our project. Our first one will be this monster. Before we start, you should give it a more descriptive name in the Hierarchy tab. Let’s call him Player. Then drag the Player instance from the Hierarchy tab to our Prefabs folder. You will now notice that the instance of the Player’s name is now blue in the Hierarchy view. We now also have a Player prefab in our Prefabs folder.  It is important to note that, while you can continue to edit the instance of the Player in the Scene, none of those changes will be saved to the actual prefab itself. Likewise, as you continue to modify the prefab, some instance-specific properties, such as position, scale, and more, will not be updated on the instance itself. This disconnect is a little frustrating to deal with at first, but it helps to understand that our Player prefab is the base template of all Players in our game. Any instance of the Player in the Scene has its own unique values from the base properties, allowing you to customize each individual prefab derivative...
Working with Sprites

Working with Sprites

This is an excerpt chapter from my Weekend Code Project: Unity’s New 2D Workflow book. I hope you enjoy this free content on how to use Unity’s new 2D features. If you like what you see, please pick up a copy of the book to get access to the artwork, source code and a PDF/ePub version of the book. Cutting Up Sprites You can continue with the project we set up earlier, or start a new one from scratch. Either way you should only have the Camera in your project, and have 2D mode toggled.  Next we need to import all of the game artwork into the Assets folder. Before we do this, let’s create a new folder called Artwork. You can easily do this by right clicking on the Assets folder itself and selecting Create > Folder. While you are at it, make the following folder structure: Artwork – Where all of our artwork goes. Misc – For extra files we create that don’t necessarily fall into one of our three main categories. Prefabs – This is where we will put completed prefabs, which I will talk about later on. Scenes – This is where you will save game Scenes. Scripts – This is where we will put all of our scripts. At this point we can drag the game artwork into our Artwork folder and open it up to take a look. Here you will see we now have everything we need to build our game with. If you select any of these images, you will notice in the Inspector panel that it has already automatically been...

Subscribe To My Mailing List

Want to learn how to make a game? Not sure where to start? Even if you are a seasoned game maker there is still a lot you can learn from my mailing list. I'll be covering tips and tricks for how to build, release and market games each month.

Simply sign up for my mailing list and also get access to a 50% off discount code for my eBooks and other content. I promise to not spam your inbox!

Join Now