Monday, April 28, 2014

Day 3 of C# Unity


     After the weekend break, I'm back at it.  I started today with every intent to continue Unity Gems, however, I realized very quickly "Common Unity Gotchas" was a bit more advanced.  Rather than get frustrated with GetComponent and all the rules and scenarios (and a StormTrooper ??), I switched back to the Unity Topics: Beginner Scripting.


Beginner Scripting
     I instantly felt more comfortable.  I worked through lessons 5 - 10.  The first two were awesome "gear ups" reviewing "If Statements" and "Loops."  These bits of code in C# are not terribly different from their JavaScript counterparts.

     Lesson 7 covered "Scope and Access Modifiers".  I already knew Scope. I did not fully understand how Access Modifiers work within Unity.  In my first exposure, I might have complained about the redundancy between setting variables in scripts and then changing parameters in the Inspector tab.  I now wish I would have worked through the scripting primer from the start.

     The lesson used a variable called "alpha" as an example.  When set to public, you can adjust "alpha" in the Inspector tab.  This made so much sense now!  How convenient to be able to tweak a parameter and see the effects immediately?!   The lesson explained the value of a variable can be set in Start().  This overrides the Inspector setting, but once game play is under way, adjustments can be made in the Inspector.  What is Start()? A perfect segue to the next lesson!

     Awake() and Start() were the subjects of lesson 8.  A solid foundation of Unity requires understanding the difference, use, and timing of these functions.  I am a bit shocked I was able to finish a project without grasping how these functions work.  The script calls Awake() first, and Start() immediately before the first Update().  I had a bit more understanding of Update() and Fixed Update(), but truly enjoyed the refresher and iteration.  It does wonders for my coding confidence.

     The final lesson reviewed "Vector Maths."  I must admit how surprised I was to enjoy this lesson.  Speckled with humor, the video covers 2D and 3D coordinate basics, explains how unity is "Left Handed," and provides useful example applications  (Tank! Tank! Tank!).


I am loving the Unity Topics tutorials and can't wait to get back to my Space Shooter project tomorrow!


Post a Comment