Unity: Hello World

Programming ,Software
October 26, 2014

Notes from going through the Unity Hello World Tutorial from Emanuel Eferonato:

  1. Binding a script to a game object controller is reminiscent of how you connect iOS Storyboard elements to their associated actions in Xcode. At least, the way I did it was – with a drag from the Asset list of scripts to the GameObject.

  2. This didn’t work for the cube. I am supposedly scripting in C#. This is a very different C# from what I’m used to with Windows Phone development, but is oddly comfortable. It will probably only take me using Console.log() instead of Debug.log() about one hundred times before I can do it right the first time.

  3. Hmm, turns out I did just need to drag that to the Cube to get it to run. What did cube.AddComponent(“CubeScript”); do? Regardless, it’s working now. Yay!

  4. Aww yiss, we have a color changing block when we click. I wonder how long it’s going to take me to remember to stop being in “play” mode when I go to re-run the game after making changes.

  5. What the flip is Quaternion? Ohhh, it’s a rotation type.

At the end of the tutorial, I’ve made an object that moves 180 degrees. It’s not super interesting, but at least it’s an interaction! After I made the cube work, I went ahead and made a sphere to do the same thing. I ran into the issue where my sphere was sitting on top of my square, so I learned about positioning:

cube.transform.localPosition = new Vector3 (222);

I still don’t see how my objects are 3D (perhaps they’re “3D” in the sense that they move in the Z axis) but I figure that can be adjusted by adding a Z dimension to my initialization, right?

Bingo!

Change:

cube.transform.localScale=new Vector3 (2,2,0.1f);

to:

cube.transform.localScale=new Vector3 (2,2,2);

This was interesting to learn: I wouldn’t have thought that you would use the scaling function to create the object size, but when I started thinking about it in terms of the way you would scale a vector graphic, it made sense. Thinking in vectors is going to be a new challenge, but I’m pretty excited about it.

That’s it for tonight – stay tuned as I .transform these introduction tutorials into general knowledge!

PS: Turns out QuickTime is actually useful and can capture Mac screen videos. TIL!

Related Posts

1 thought on “Unity: Hello World”

Leave a Reply