Overlapping objects using Unity PSB Importer!

The PSD Importer is one of the best features for making 2D games. It saves a lot of time, because we are able to update the PSB file, and the updated sprite will be reflected in Unity immediately.

You can read more about the advantages of PSB Importer here.

But after setting up your characters, you may see this that some limbs from a further away characters are overlapping the front characters. This is because each limb is assigned to a sorting layer, and sorting layer is global. If the eyes are higher than the head,  ALL the eyes will overlap ALL the heads.

You can see an example below.

The solution is very simple. Just apply Sorting Group to the parent gameobject or the main child gameobject.

And the limbs of your character will be grouped together. Unity is just awesome!

Finally, if you have setup your pivot properly, you just need to change some settings in Project settings, under Transparency Sort Axis.

And magic!

Setting up 2D characters in Unity

To setup a 2D character, what we did, was to create an empty gameobject as the parent container for the sprites, animations, effects and other objects.

In theory, we will want to create a parent container. It should house the script and collider. And we should add an Animator components on the child to animate the all child gameobjects.

The concept is simple, if we put animator component on the parent object, it will clash with the movement script. So all animations should be affecting the child while the character can still be moved around.

But this is assuming we are making a side scrolling game that don’t allow the character to jump, or we “design” the game such that during a jump, the character is invincible, because the collider is turned off, while the shadow is still on the ground. This is another topic what we will cover at a later stage when we are coding the character behavior.

Next, we need to setup the pivot point of the Asset. We are making a side-scrolling game, so that we need to use the bottom centre of the character. Bottom centre is where we place the collider and the position of the characters, to follow correct overlapping of characters.

We do that by selecting the asset in Project tab, and select custom for pivot.

This is a simple setup for 2D characters, the same concept works for spritesheets. However, if you are using PSD importer, you will encounter some other issues. See issues here.

Creating Neko’s idle animation

The first animation I created, was the idle animation for Neko.

To make an interesting idle animation, I applied these animation principles below:

  1. Anticipation – Movement of the eyes before looking away
  2. Secondary Action – Subtle movement on the ears and eyes movement
  3. Wave Action – Looping tail animation
  4. Squash and Stretch – The bouncy feeling when Neko is looking away

As you see above, the character looks more lively and bouncy just by adding a simple Squash and Stretch.

After adding Secondary action to the ear, Neko has this subtle ear movement which gives it more life. Although it’s not Disney quality, it’s better than having a sluggish character.

Anima2D vs Unity’s new 2D Animation vs Spine

I feel that the Animation tool is very important for a 2D game, hence I tried 3 different tools – Spine, Anima2D and Unity’s new 2D Animation.

I started with Spine. Getting into the flow was easy since I had been using it for a while.

It is easy to export the animation for Unity. My opinion about Spine is that it is a very lightweight software, it loads fast, it’s easy to pick up, and the quality is out of this world. There are lots of Spine animators out there and it is not hard to find someone to help out with your games.

I tried using Anima2D because I read about some runtime issues for Spine. The animation data from Spine has to be exported to JSON to import into Unity. (Hmmm… isn’t it similar to other 3d software? Exporting to FBX with all the data?) Anyway, Anima2D is a great tool and it was very well integrated into Unity, I tried rigging a character and did a quick animation test, everything feels good. And I heard that the guy who developed the tool was hired by Unity. Check out the screen capture for rigging the tail.

And finally, I installed Unity’s 2D Animation package and explored around, and followed their online documentation. To my surprise, the tool worked very well for me. Even though it’s still a “preview” feature. Thanks to the talented team at Unity who are still catching bugs and improving the software while I’m writing this post. The tool is similar to Spine and Anima2D, and the development flow seems to be more integrated than Anima2D. You can check out how I set up the character’s sprite, bones and rig below.

After testing out the 3 different tools, I felt that there’s not much difference between Anima2D and Unity’s 2D Animation. Although Spine a more powerful tool and it’s easier to find animators who know how to use Spine, I decided to go with Unity’s native 2D Animation.

Reason being, I’m not a real programmer. I chose a native tool, so I have lesser things to troubleshoot when there are Game Engine upgrades. But these were just my personal opinions.

If you have any questions or feedback, feel free to send me an email. 🙂

Beginning of Nekomancer

Truth is… I couldn’t sit still and go through the whole online course. My brain was filled with little scenes of what I can do in Unity.

I thought it’s time to start something more exciting – Design a game that I’m capable of completing by myself.

Nekomancer was conceived after having these thoughts in my head

  1. How about a Necromancer game?
  2. Nah… necromancer is so overused.
  3. And I thought about my wife’s puns.
  4. Hmmm… how about Neko-mancer?
  5. He can raise undead cats to help him.
  6. Ahh~ cute and deadly, a lethal combo.
  7. Alright, I think it’s going to be awesome!

Learning Unity… again

In 2018, after much discussion with my wife, I decided to start developing games again. After considering different game engines, I took the leap to start learning Unity(again) after my last attempt in 2011. (Unity version 2.5?)

Compared to 2011, there are so much more resources available, and so many assets to speed up the game development.

I started my indie journey with this online course, The Ultimate Guide to Game Development with Unity, the course is very structured, and introduced a lot of the concept behind how Unity works.

Unity also has lots of new 2D features that are so helpful in creating 2D games. I felt that I made the right choice moving to Unity.