How We Use Unity
We’re using Unity exclusively at Bane Games and are absolutely loving it. I get asked a lot about what tools we use and how we lay out our projects. Today I discuss this briefly and would love to hear about the 3rd party tools you recommend and how you make your games in Unity.
3rd Party Tools
We love the Asset Store and think this is one of the big selling points of Unity. I know a couple of Asset Store developers and they speak highly of the ease of development when extending Unity as well as the revenue generated. There are four main tools we use.
Our first three games used a simple rendering system that I created. While this worked well for our first few games, it was one of the main areas I wanted to make use of someone else’s technology to give us access to atlasing/batching, more robust animations and general performance improvements. After some investigation back in 2013 I found that 2D Toolkit was one of the two or three major contenders. After some experimentation I found it to be exactly what we were after.
We began using 2D toolkit for a number of prototypes we were developing as we decided on the next game to create. We have now embraced it fully and are using it both for prototyping and the full games we are working on (Battle Group 2 (BG2) and our space game). We’ve found it easy to use, almost entirely bug free and extremely performant. We’ve gone from 90+ draw calls in Battle Group 1 (which used my custom, simple, rendering system) to less than 10 in Battle Group 2.
With the release of Unity’s 2D system we will access our options when we begin work on our next game. After some quick investigation though I’ve found that 2D Toolkit overs everything we need and has been updated to make use of some of the new features in Unity’s 2D, such as sorting layers and the 2D viewport.
GUI support in Unity has been an issue for me from the time I started developing in it in 2011. When I used to give talks on Unity I would list it among the few negatives to development and as of 2014 it’s the only remaining issue that has not been resolved. We can expect Unity’s new GUI system in the coming months, but until then, the best choice is NGUI.
I’ve tried every GUI library on the Asset Store and unfortunately I have not found one I’m happy with. NGUI is the best of the options, however we are having a bunch of issues with it (such as image sprites swapping place in the atlas without updating in game). We’re hoping things will improve in time and we will definitely be reviewing Unity’s new GUI system for our space game.
Autopilot is invaluable for anyone who targets iOS. It integrates with TestFlight and allows you to publish a build with a single click. Where we used to take ~20 minutes to make a build and upload to TestFlight, we can now complete the whole process automatically. I highly recommend Test Flight and AutoPilot to anyone who requires build to be created for iOS.
UnityVS is an invaluable tool for anyone who uses Visual Studio as their primary IDE while developing Unity games. UnityVS lets you attach a debugger to Unity as it runs on your development PC and both set breakpoints and step through the code. It doesn’t support the full functionality of the debugger (such as changing current source execution line) however it does do the majority of tasks required for debugging. It’s a great alternative to the standard Debug.Log() way of finding bugs in code. It integrates well with Unity and Visual Studio and despite it’s minor quirks is highly recommended.
Our project structure is fairly standard from those I’ve talked to about their Unity setup. We break scenes, scripts, images, etc up into specific directories to keep things as organized as possible as the project grows. There are a few key techniques we use that I think are worth mentioning.
A Single Scene File
As much as I can, I like to keep the scene file count to a minimum. When possible we like to have a single scene for the game including main menu, in-game and pause states. This gives us full control over load times between levels and lets us seamlessly switch from game to menu. We’ve had success with this in the past during our prototypes, however BG2 will be our first published game that uses a single scene.
In addition to this single game scene, we do have a splash screen that is as simple as possible to make sure it loads within the required time on iOS so our application is not termianated. We also usually have an intro movie scene which displays our intro logos and movie.
Multiple Scene Files During Development
One caveat to the single scene file setup is that we do break the menu and in-game up into separate scenes during development. We use a LoadLevelAdditive() to load the in-game in when the Menu.scene file is being edited. This allows us to play the full game from the Menu.scene while still quickly accessing the gameplay without bothering with the menu through the InGame.scene file.
We have a “Global Object” GameObject that is used for storing references to shared objects within the game. This allows multiple GameObject’s to share a reference without having to look them up at run-time and allows changing the object referenced in a single place without having to remember and find every GameObject that accesses them.
There are a few things we’re not currently using that we would like to begin using on future projects.
Unity has recently released a suite of unit testing functionality within Unity. I’m a huge fan of Unit Testing and Test Driven Development (TDD) and it’s one of the areas game development has lagged a long way behind other software development. For our projects that use the MVC pattern I’ve used TDD as much as I can with great success. I see the built-in Unit Testing functionality filling the gap and allowing much more of our code to be unit tested in the future. The only reason we haven’t begun using this is that it’s too new for us to have adopted yet.
Asset Store Tools
I would like to roll up some of the tools we use internally and offer them for sale on the Asset Store. This will encourage me to make them as robust as I can as well as generate some secondary income from the work we’ve completed. As I mentioned previously, I’ve heard good things from my friends that have released products on the Asset Store and I see it as a great way of giving back to the Unity community.
This is a quick wrap up of how we are using Unity for our 4th title in the engine. What 3rd Party Tools do you recommend? How do you lay out your Unity Projects and what tips do you have for other developers?