Unity FAQ and Tips

This page provides tips for using Unity and some solutions for common problems with Unity game development.

FAQ

Topics/Questions:

Where can I download Unity?

  • For your own use, you can download the Personal edition from the Unity website by clicking here. When you install Unity, make sure you also include any standard assets, demo projects and files, and MonoDevelop in the installation.

Where can I find a list of keyboard shortcuts for Unity?

Which programming language should I write my scripts in?

  • It is completely up to you. You can use C# (pronounced C Sharp), JavaScript, or Boo. However, these tutorials will demonstrate using the C# language. Also, C# is the main language documented on the Unity website so there are many more tutorials and resources available for that language. Boo is also no longer documented on the Unity website and although you can still use Boo in Unity 5, there is no longer a menu option to create new Boo scripts within the Unity 5 user interface (more info here). It is up to you to decide on a language but C# is highly recommended for Unity and is a great language to learn.

Why do changes made to my game keep disappearing?

  • Make sure that your game is not in Play mode. If you make changes to the game while it is playing, these changes will not be saved. You can make temporary changes during Play mode for testing purposes but beware – nothing will be saved!

Why do material properties disappear from the Inspector and how can I get them back?

  • Sometimes material properties disappear from the Inspector preventing you from making changes. It is unclear why this happens but you can fix it by clicking on the material’s name (the text) in the Inspector panel. The material properties should reappear in the Inspector panel.

Why is Unity running so slow?

  • Unity can run slow for a number of reasons. Firstly, you might have imported too many packages in Unity. Only import the packages that you need for your project – don’t import every single package!
  • Your game might have a lot of objects, terrains, characters, materials and textures for your computer to handle. Unity doesn’t require extreme specs to run but the specs that you need on your computer will depend on the scale of your project.
  • Remove or reduce the amount of grass and trees
  • There are some things you can do to improve performance such as not adding trees or extra detail to terrain on parts of the game map where your character will never actually visit.
  • Think about breaking up your scenes eg. don’t put every single level of the game in a single scene.
  • Reduce the amount of texturing on areas of the environment that are less visible to the player.

How can I fix the zoom/pan when it becomes really slow?

  • If zoom/pan becomes slow, double-click on the object or terrain (or the nearest object to the area) you want to zoom into/pan around in the hierarchy panel. Then you should be able to quickly zoom in/out again.

Errors still show up in the console even after they have been fixed. How can I fix this?

  • Just click on Clear to remove error notices. If they disappear then the errors are probably no longer an issue. If they reappear, then something needs fixing.

Changes I have made to my scripts do not show up in my game. Why does this happen and how can I fix it?

  • The values in the Inspector panel will override the values in the script file. Change the values or reset them in the Inspector view. Also, make sure that you are not still in Play mode when changing values in the Inspector otherwise the changes you make will not be saved.

How can I find instructions on using different functions in my scripts and understanding the syntax of the selected programming language?

  • Click on Help > Scripting Reference. Then select your chosen programming language.

My scripts are going crazy. Help?

  • Make sure that you don’t have any clashing scripts. Click on the cog icon next to the old script you no longer want attached to an object or asset (in the Inspector panel), and then click on Remove Component.
  • Make sure that values in the Inspector panel are not overriding values you have in the script.
  • Make sure you have the correct script file linked to the object/asset.
  • Check the Console for any errors that may have been found.

How do I remove a script from an object/asset?

  • Click on the cog icon next to the script in the Inspector panel, then click on Remove Component. You should remove any scripts that are no longer needed or that clash with other scripts.

MonoDevelop didn’t load/it crashed. Why? What do I do?

  • Sometimes MonoDevelop crashes when it launches. In Windows, go into the task manager (Ctrl + Alt + Delete) and end the program. Then relaunch the script in MonoDevelop (or your chosen script-editor). In Mac, click on the Apple icon on your menu bar and click on Force Quit, then select MonoDevelop from the list and force quit the program. Relaunch the script in MonoDevelop (or your chosen script-editor).

I can’t see the grass I added to my terrain. Why?

  • Zoom in on the terrain where you have added the grass. Grass does not render until you zoom in on it (otherwise Unity would run very slow if you had a lot of grass)

Why don’t I have the Standard Assets asset package?

  • Depending on what version of Unity you have and how you installed it, you might not have the Standard Assets asset package. But don’t worry because you can download it for free from here.

I get an error message about saying “there are 2 audio listeners in the scene. Please ensure there is always exactly one audio listener in the scene.”

  • There should only ever be one audio listener in a scene. If you have more than one audio listener in a scene then you will probably receive this error message and you will have issues with sound. Have a look at all the cameras and cameras attached to objects in the Inspector and uncheck all of the ‘Audio Listener’ checkboxes except for the main audio listener (usually either the main camera or the camera attached to your player object).

In my code, I receive the error message: error CS1525: Unexpected symbol `public’. What does this mean?

  • This probably means you have either left out a bracket such as ‘}’ on the previous line, or you may have tried to declare a public variable inside a function – you can’t do this. Declare the public variable outside of the function. It can then be called inside a function if needed.

Where can I find the keycodes for keypresses on the keyboard and other input devices?

  • You can find a list of keycodes here.

Why do objects fall through my terrain?

If you add have created objects with colliders that fall through your terrain that has a collider, you might want to disable the collider on your terrain and then use another collider attached to an empty GameObject. Click on GameObject > Create Empty an then attach a collider to that empty object. You can enable ‘Is Trigger’ on that object and then move the object and resize its collider so that it is positioned under your terrain.

How many programmers does it take to change a light bulb?

  • None. It’s a hardware problem.

Tips

  • Only import packages that are necessary for your project. Importing all packages will reduce performance.
  • Save your work frequently and before any major changes.
  • Press Ctrl + Space to enable AutoComplete when writing scripts in MonoDevelop.
  • You can use other script editors apart from MonoDevelop (eg. SublimeText).
  • Create folders in Unity (in the Assets panel) to organise your content. Eg. create a Textures folder, Materials folder, Scripts folder, and Scenes folder. In the Assets panel, right-click, click on Create and then Folder to make a new folder.
  • Make sure you name assets and scripts well. With scripts, make sure there are no spaces in the file name. Using camelcase is also not a bad idea.
  • Use the keyboard shortcuts to navigate around quickly and easily.