Tuesday, April 8, 2014

Unity Endless Runner Tutorial #3 - Boost Logo

Original Tutorial

My version of the game (Version Log)

GitHub Gist (for full code files)

Completed Project Files (V0.6.1)
Buy this on Selz Selz powering ecommerce websites

For version 0.3, I added a boost logo next to the logo counter to make the GUI more user-friendly. You could get the image I used as GUI texture below.

To add this, you need to create a GUI Texture object in Unity (I am using Unity 4.3 and the way is Game Object> Create Other> GUI Texture). I named it Boosts Sign and put it under GUI. Add the Boost image as its texture. For the size of the GUI Texture, I am using Pixel Inset of (0, -20) for XY and (20, 20) for WH.

Now, we need to re-position our boost counter as well as the boost image. I used (0.01, 0.99, 0) for XYZ of Boosts Sign and (0.04, 0.99, 0) for XYZ of Boosts Text.

Next, we need to enable and disable the Boosts Sign as well in Game Start. Go to GUIManager.cs and add public GUITexture boostsSign; to it (don’t forget to attach Boosts Sign to the GUI Manager once you are done with the code). In the same file:
  1. under Start(), add boostsSign.enabled = false;
  2. under GameStart(), add boostsSign.enabled = true;
Done! I am planning to do recording highscore next but it will take some time since I need to learn it first. Cheers!

No comments:

Post a Comment