I can't believe the semester is over already! And I really can't believe that I have a mostly-working prototype of Abandon in Unity. Here's a screenshot of my version of level 15, "Hopscotch", side by side with the same level in Abandon:
Along the way, I've tried to record some of the day-to-day bugs and challenges of learning to use Unity. Here are some issues I had during the learning process that I may not have specifically mentioned:
- There doesn't seem to be any sort of ambient light available. The closest thing to it is a directional light, which shines in only one direction but shines in that direction all over the gamespace. The only other light options are point light and spotlight.
- Unity's version of C# seems to have nonstandard capitalization requirements. I found this out when I tried to use Caryn's text reader program and it refused to work until I changed a few capitals. In general, capitalization is very important to the scripting syntax.
- The scale of an object given in the inspector view is its local scale--that is, the size of the object relative to its original size. Likewise, if an object is the child of another object, the xyz coordinates given will be its position relative to its parent. This can make it difficult to determine an object's global location or relative size.
- Every object in a scene will have a Transform, so a lot of the functions that you might think would belong to the GameObject class, such as IsChildOf, are actually under Transform. I forgot this a lot. Very often Unity would tell me a function I had used didn't exist, and the fix would turn out to be changing gameObject.Function() to gameObject.transform.Function().
- The output buffer displays at the bottom of the screen (not the top, as the video tutorials claim), and you have to click on it if you want to view more than one line at a time.
- The vector Vector3.forward points along the z axis, but in the default perspective view in the scene view, this is not the direction you are facing. I had some trouble with that when I tried to write keyboard input using the arrow keys and the player seemed to be going in the wrong direction. The game view looks in whichever direction the camera is looking.
- If you create a variable in a method and never use it, Unity will send you a warning... but if you create an instance variable and never use it, you will not be reminded to do anything about it.
The main documentation page has links to a number of useful resources, including the Unity script reference, the user manual, and the reference manual--and no, I don't know what the difference is between the last two. I especially recommend watching the video tutorials before getting started, to give yourself some idea of how Unity works and where to begin. They also explain how to navigate the scene view, and some basic concepts like parenting which will be very useful later.
The Unity documentation is generally helpful, but in some respects lacking. It's easy to look up a particular command, but not so easy to find the command that does what you want to do. For reference, here are some especially useful pages from the script reference and the manuals:
- Scripting Overview
- Writing Scripts in C#
- The most important classes
- Two pages about GameObjects
- The GameObject class
- Accessing other GameObjects
- Using Components
- The Component class
- Physics components
- Instantiating prefabs at runtime
When all else fails, your best option is to try the Unity forums. I got answers to a lot of my questions that way, and everyone who posted was very friendly and helpful.
Now that I know more about Unity, there are some things I would have done differently when I made the game. For example, if I had known about the CharacterController component sooner, I would have taken some time to learn how to use it, which might have worked better with the physics functions than using a collider.