Search Unity

Where do I start with programing

Discussion in 'Getting Started' started by RoboticCoder, Apr 8, 2015.

  1. RoboticCoder

    RoboticCoder

    Joined:
    Apr 5, 2015
    Posts:
    5
    Where can I start with learning to code with C#. I know theres a learn section on Unity, but please don't link me there because its out of date. I tried some you tube tutorials, but when I type up the script it dosen't work, because they are all usually out of date. Also I went to some websites that teach it, and it becomes confusing because they just give you all of the syntax (I think thats what its called), and it dosen't use an editor so I cant associate with Unity at all. Please send me a link some where like an up to date video tutorial that teaches it in Unity or just tell me.
     
  2. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    21,187
    Most of the time the problem with Unity's learning tutorials involves the quick property accessors. They were removed with the release of 5.0 and instead you need to use a function called GetComponent.

    http://docs.unity3d.com/ScriptReference/GameObject.GetComponent.html

    As an example, accessing the AddForce function of the rigidbody component prior to 5.0 was done like the following:
    Code (csharp):
    1. rigidbody.AddForce
    The new way now looks like this:
    Code (csharp):
    1. GetComponent<Rigidbody>().AddForce
    Other than that I'm not aware of any other scripting problems with the tutorials. I've heard the Stealth project is broken due to changes in the physics (PhysX had a major version increase in 5.0), but that's not really a scripting issue.

    Alternatively you can simply install an older release of Unity, such as 4.6, until you've gotten a reasonable grasp on the basics. Once you've done that you could move forward to 5.0 and learn the changes that came with it. You can install multiple copies of Unity pretty easily by simply change the installation path.

    http://unity3d.com/get-unity/download/archive

    There is a third option, but it is a bit of a weird approach. You can learn C# first and then pick up Unity through a combination of the reference manual (primarily the scripting section) and examining existing code in the free example assets along with making minor adjustments to see what's happening.

    This was largely the approach I used, but I was a programmer prior to picking up Unity and already had dabbled with other engines such as Unreal 3. If you're new to programming it likely isn't the path you want.

    The C# Yellow Book by Rob Miles is a free ebook and very highly recommended for learning C# itself. You can use it with Visual Studio's C# or you can throw a GameObject into a scene, attach a script to it, and work your code inside the script. Simply treat the "Start" function as if it were "main".

    http://www.robmiles.com/c-yellow-book/
     
    Last edited: Apr 9, 2015
    BrandyStarbrite likes this.
  3. christinanorwood

    christinanorwood

    Joined:
    Aug 9, 2013
    Posts:
    402
    Last edited: Apr 9, 2015
  4. RoboticCoder

    RoboticCoder

    Joined:
    Apr 5, 2015
    Posts:
    5
    Ok thanks for the help. @christinanorwood is the second option that you mentioned up to date. Thanks again.
     
  5. christinanorwood

    christinanorwood

    Joined:
    Aug 9, 2013
    Posts:
    402
    He made the course using Unity 5 while it was in beta testing phase. It does include the recent changes. You do have to be a CGCookie member to get the tutorial though.