Improve your efficiency with MonoDevelop

Everyone has their own workflow and choice of Scripting IDE, but if you’re one of those using MonoDevelop with Unity this blog post should help with an increase in efficiency when working with it..

I’m using a Mac and so the workflow improvements will be based on using MonoDevelop on a Mac.

Syntax Highlighting is important for writing and reading code, MonoDevelop makes it easy to change this, simply click on MonoDevelop-Unity menu item and then click Preferences, the Preferences window will open, there’s a menu on the left hand side, under Text Editor -> Select Syntax Highlighting there will appear eight options for you to chose from. My preference is called Oblivion but pick and test one for yourself which suits you best. You can also enable semantic highlighting which helps with reading code. Use cmd + / –  to zoom in and out, so you can see the code you are writing.

Keyboard shortcuts:

Who doesn’t like a good keyboard shortcut, yes there’s many to remember from many different software packages we use, but I think it’s important to have a few for each package that are your most important to your workflow. So here’s a few I feel worth highlighting for an increased workflow:

Saving scripts:

  • cmd + S = Save Script – Unity picks up this save and recompiles to reflect the changes
  • cmd + shift + S = Save all scripts open, useful if you’re manipulating multiple scripts when coding public / public static functions etc

Scripting layout :

  • cmd +[ and cmd + ] = Indents code, allowing to quickly indent lines of code without having to use the tab key
  • cmd + / = Quickly comment out some code or  comment your comments
  • shift + arrow keys = Select lines of code or symbols real fast
  • cmd + shift + Y = Finds references to that code snippet and displays the info in a window below
  • alt / option + arrow keys = Move lines of code or the cursor through lines of code

Debugging:

  • cmd + return / enter = This starts debugging mode from the Run menu item, no need to go through menu items
  • cmd + \ = Toggles breakpoint, no need to go through the Run menu item
  • cmd + shift + I = Step Into, no need to go through the Run menu item
  • cmd + shift + O = Step Over
  • cmd + shift + U = Step Out

Other useful actions, “Attach to Process” and “Detach” when debugging Unity, these don’t have any default keyboard shortcuts, but if you enter MonoDevelop-Unity menu item and reopen Preferences window, you can add your own under “Key Bindings”. This also shows everything I just highlighted and more.

Hope this all helps and please share your workflow improvements!

Localization Support with Unity!

LanguageManage

New users to Unity tend to ask about an integrated support for localization within the editor (built-in tools), currently Unity does not have this, so users ask for solutions and what’s available to get this setup. I found a free package on the asset store titled Language Manager – which is a key based system and easy to integrate multiple language support for your games and apps. Let’s take a deeper look into the package and highlight the ease of use in getting it setup:

Getting Started:

  1. Create an AssetStore Account if you haven’t got a UDN account setup already
  2. Do a search for Language Manager or follow this link for the browser version: https://www.assetstore.unity3d.com/#/content/1018
  3. Download and import the asset package into a new project – Best to test it out before directly importing into your current professional project

Within your new Unity project, you will see a folder named “LanguageManager” in the project window. The folder contains the scripts and resources needed to add localisation support to your game or app, included support already for 6 different languages. We shall take a quick look at the sample scene included.

Double click the sample scene to open – click the main camera in the hierarchy window and notice the script component named: TestScript.

The script contains:

  • A GUI Selection Grid, allowing the user to press a GUI button to switch languages
  • A public string which gives the option to select the default language in the inspector
  • A Switch statement containing support for all 6 languages (English, Spanish, French, Italian, Chinese and Russian)

Hit play and observe the two GUI sentences at the top left of the game view are rendered in your chosen default language, the GUI buttons below allows the user to switch to a different language, clicking Russian will update the text to be displayed in Russian characters as well as for the GUI buttons. This example scene can be adapted to be used as a Language menu screen at the beginning of your game / app or in the main menu screen

It’s also worth mentioning you can get the system / OS language from an API call Application.systemLanguage – this returns the users OS default language, works on Mobile devices as well as PC, Mac and other major platforms, some are not supported so ensure to test that out. Example code for this in C# of course:

using UnityEngine;
using System.Collections;

public class OSLanguage : MonoBehaviour
{
void Update()
{
guiText.text = Application.systemLanguage.ToString();
}
}

Back to the LanguageManager package,. There is a custom Window included in the Unity Window drop down menu -> Language Editor, this allows the user to create new keys and create files for different languages (I imagine as many you like). The package contains support for an initializer – LanguageManager.LoadLanguageFile(defaultLanguage); and use it by calling – LanguageManager.GetText(“string key”); That’s where you relate your key’s added in the Language Editor window, for example the string key for  English language is “english”. 🙂 – with just a few lines of code you can get basic support for multiple languages within your games / apps and apply them to GUI elements in your scene/s.

Take a look at the package, it’s a free download after all, also checkout the many other packages on the Asset Store here.

Modelling a Sports Stadium

Rugby Skills Challenge 2013

I’ve had a great month and half or so developing a 3d model and beta testing on a recently released iOS title by game developer Russ Morris.

We got talking about his Rugby game at the Unity UK Christmas party and Russ mentioned about needing a Stadium model for his game, naturally I said “hey, I’ll give it a go” and after a lengthy conversation in which I actually remember the day after, I nagged him for a bit to send over the details, thankfully Russ obliged and the creative development began.

So I wanted to blog about the development of the stadium model and some of the techniques I used, trying to keep it as low poly as possible for mobile development.

Starting point:

My starting point is the centre piece, the field of play, I needed to research the typical dimensions for a Rugby pitch. Modelling the basic rectangular shape then expanding out from there, having the focus point in place gave me a good start in terms of thinking and planning the architecture of the model. Using reference images taken from Cardiff’s Millennium stadium and the Aviva stadium in Ireland, the important thing was to ensure the shape and architecture of the model was directed at the main focus point (the field).

Pitch

The design is to have the curved corners in the tiers, so the stadium is a full oval curved shape like most modern day stadiums have. From here I started building up the second tier and adding some basic roof structure just to get an idea and feel for the model.

Adding details:

I quickly moved on to adding details to the tiers, adding steps and entrance points for isles, the challenging area was creating the corner tiers, I used the technique of extruding and rotating each time by hand, but I could of used the bridge tool and add the correct amount of segments, then reposition each set of poly’s, either technique would of worked fine.

Adding Detail

I finished the lower tier, so I had a fully completed lower tier with steps and isle details added, the good thing is, for the top tier, I can duplicate the lower tier and make adjustments to the positions of some poly’s and up scale when needed, no need to fully model the top tier from the start again. Here’s both tiers fully completed:

Fully completed stands.

I needed to close the gaps up and model some outer geometry, I modelled a bunch of cubes and joined the verts together at each adjacent point, It was just about getting the right positions and joining the correct verts together.

Creating the roof:

The roof structure design is to be based on the Millennium stadium in Cardiff, the corners needed to have gaps, the support structures needed to be added as well.

The Millennium Stadium
Adding roof structure
Support structure

Combining all this together gives me something nearly complete, all the rest of the tweaks were added by Russ in the game project, such as texturing and advertising boards etc.. Here’s the final model in Modo:

Rugby Stadium

Download and install the game now, you can download it by searching for Rugby Skills Challenge 2013 on the app store or by clicking the image below which redirects you to the app store:

appstoreThanks!