Learning Unity3D

For some time I’ve considered trying out games programming. Not that I think I’ll ever create much worthwhile but it seems like a fun challenge and a decent break from my usual web app stuff. One of the hardest decisions is the first; what language/environment to use? There is an astonishing number of options (far too many to remember or write about here) so I’ll simply say that I chose Unity3D in the end.  My reasoning:

  1. It’s free
  2. I like C# and Visual Studio – C++ was another option but as I stated earlier, I wanted a “fun challenge”. Plus the Unreal Engine is $20 per month (cheap for sure, but not free).
  3. Lots of tutorials and sites.

During the first tutorial (Project Roll-a-Ball) I stumbled upon a minor issue. The author was using GUI Text which is now seemingly considered as “Legacy”, and not selectable in the Unity Editor. Instead it is necessary to use UI Text. Easy, right? Nope. Being new to Unity it took me some time to find this alternative and work out that it is also necessary to make a few adjustments to the code shown in the video.

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour
{
    public float speed;
    private int count;
    public GUIText countText;
    public GUIText winText;

The code above needs to have the reference UnityEngine.UI added, then instead of creating our variables as GUIText they can simply be created as Text.

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class PlayerController : MonoBehaviour
{
    public float speed;
    private int count;
    public Text countText;
    public Text winText;

If I missed something let me know. J

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.