Xerra's Blog

Drunken coder ramblings

Getting the basics right —

The reason for developing our Paradroid project is primarily a learning exersize in how to “Unity”

This means, for starters, I’m going to need to have some knowledge of C#. I’m not going to need to be brilliant at it but Unity requires various amounts of raw code within a project unless you’re doing something really basic that you can bang together with just the drag and drop elements.

Paradroid is going to need a fair bit of code within it because it’s not a massive, pretty 3d project that can use dumped in particle effects, 3d landscapes and just rely on Unity cameras to do all the movement work within the limitations of what the UI lets you tinker with. And, with Unity, it’s C# or Java. I know very little about either language so i’m taking a bit of time to start getting the gist of the syntax in comparison to other languages I’ve worked in as it may save some of the inevitable headaches later on.

So I bought a book. A book on C# which has been written to work alongside Microsofts current implementation of Visual Studio (2015). All well and good, even though I work on a Mac system, as there’s a beta build of VS out for Mac now, and it should be identical in use to the Windows/PC one, right?

Wrong. It does things its own way. Probably just fine for advanced Mac users who know the product but are starting with new projects and doing things their own way. But I’m working from a book which holds your hand the entire way, and expects you to follow it pretty rigid.

My solution for this (thanks to Aaron’s suggestion) was to go the first few chapters where it’s dealing primarily with the functions of the language and outputting to console in a Unity wrapper. This means putting a basic Unity project in place, attaching a script object to it, and then outputting to the Unity output console with the results of what I’m doing.

You can see the result of that in the image below. It even shows the C# code which only logs “Hello” as is, kind of like the old Hello World program that every language ever written uses as an example to show its syntax.


I’ll be building all my test code which needs console output into a seperate function within that script and letting Unity give me the results rather than try digging around for a basic C# interpreter I can use in a Mac terminal window.

Could probably do that instead but it’s playing with Unity to do stuff like this that gets me used to using the thing. So why the hell not.

Here’s the script in copy/paste format for anyone who actually would find this useful apart from me.

using UnityEngine;
using System.Collections;

public class Blah : MonoBehaviour {
    void Start () {
    void MyGameLog() {
        Debug.Log (Hello);

That will be edited a lot once I start using it as it will need to put everything into a public variable and push to the log function but it’s just shown as an illustration for now. And because I might find it amusing a few years down the line when I look at this again. And maybe know a bit more about what i’m talking about by then.


Categorised as: Development | Paradroid | Unity

Leave a Reply

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