Big Bad Robots is an indie game developer but we also do contract development. We have developed on all kinds of platforms (PC,Handheld,Consoles) but now primarily focus on iOS,Android and Unity. Contact us if you looking for developers with over 20 years experience in software and game development at biz -at- bigbadrobots.com

Tips on Unity3D (Top 10) I

April 3, 2011terence

I have been using Unity for a while and just my my sake I wanted to compile a list of Do’s and Don’ts that will save you a lot of time (or if you are like me stop from going Doh! and hitting your forehead a few hours later).

1. Importing from Blender to Unity. Make sure you set the import to calculate your normals again. At least in Blender 2.56a the exports product models with extremely dark Textures. So unless you want environments in your game to be a homage to 2001 Space Odyssey.

2. Work in 1 language, if possible work in C#. I know Javascript is there for web-heads and people like Javascript but it’s like giving a loaded gun to a child. Results can be un-pleasent. I have read that C# is faster somewhere but they all get compiled down to the same bytecode. The biggest reason is Javascript can include C# components but not vice-versa I suspect because of different compilation and linking times (well unless you move your javascript somewhere special). Also C# can be compiled to DLL’s. And finally coding in 1 language helps you stay good with the syntax. No fun at 2:00pm wondering your script won’t work.

3.Never use gravity a local variable name. In fact make sure if the editor highlight any variables that you aren’t using as a public or private variable. Bad things happen.

4. Always print out the gameobject you are acting against if you can’t find the components on it. I was trying to figure out why my projectiles wasn’t able to SendMessages or access components on a gameobject. The Tag was right. Made a fool of myself on Unity answers.

5. You CAN attach multiple scripts to a player. You can attach it to colliders on the bones that are hidden ONLY if you drag it to the scene and inspect it there. It won’t show up on the prefab.

6. Use the 80/20 rule of networking (well my 80/20 rule anyways)..If you think or findout that 80 percent of the time the variable needs to be updated, use state updates to do it versus RPC’s. I haven’t done a benchmark on Unity3D RPC’s but in my past experience with newtork coding RPC are slow, not timely and fat on network bandwidth. Easy to use again, but not to often.

7. Put something in your script name to help you find where it is. When inspecting a game object you can find scripts attached but have to hunt for the scripts. Putting all the scripts in 1 place and for me starting with a Prefix is a must. For example call player code ‘PlayerInputController’ and put it under a player folder in scripts. Good for you and good for any programmers that follow

8. Understand the code your write (or copy). There are alot of helpful scripts but the need to complete a project will drive you to cut and paste code. Soon you will have jumble of unoptimized code and if you don’t understand it a nightmare just waiting to happen.

9. The inspector can be useful to debug your game. If you select it during gameplay, you can check out public variables. It’s a quick and dirty way to do debugging rather then setting breakpoints which I haven’t done yet because it’s a pain to switch to the MonoDevelop (which is buggy, the scroll bars don’t respond to my mouse wheel and the folder ‘lock up’ so I can open it to click on scripts).

10. Beer and code don’t mix unless you have to re-write some particularly painful code. ;P

One response to “Tips on Unity3D (Top 10) I”

  1. […] A very beautiful Monday morning, where I’ve finally recovered after weeks of “debugging” the viral infection. A week after the Unity3D Workshop held by ACA Pacific, my Facebook’s feeds show me a great post by Terence Tan on Unity3D titled “Tips on Unity3d (Top 10)”. Having being part of the mentoring team looking after MSC Malaysia IPCC Games Competition, where some of them using Unity3D as their development tool. I believe this is a MUST read for developers out there, especially the MSC Malaysia IPCC 2011 is around the corner, plus the hype about Unity3D in recent years, it’s however, not as easy as one would think. Link […]

Leave a Reply

Your email address will not be published. Required fields are marked *