Search Unity

About Scripting

Discussion in 'Getting Started' started by Engkiong, May 21, 2017.

  1. Engkiong

    Engkiong

    Joined:
    May 21, 2017
    Posts:
    2
    Hi everyone,

    I'm new in Unity so please guide me along.

    While learning on how to write a script on Unity, how do i know when to use what kind of code such as "Int", "Void", "Trigger" and etc..Is there a link that allows me to understand more about all this. Please advise! Thanks!
     
  2. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Sure.. "int" and "void" are C# keywords.
    "Trigger" isn't anything on its own, but it's a Unity specific thing.

    When you want to use "int" is if you have an integer variable (or method returning an integer).
    when you want to use "void" is when you have a method(/function) that doesn't have anything to return.
    Methods are written like so: return-type method_name ( parameters(/none)) { body of method }

    To learn those very basics, you can try online C# tutorials and/or beginner tutorials for scripting made by Unity, then move on to beginning lessons/tutorials for unity specific details, after that.

    This is one resource online that can help you with general C# stuff : http://learncs.org/
    Unity scripting tutorials: https://unity3d.com/learn/tutorials/s/scripting
     
    Last edited: May 21, 2017
    Kiwasi, Bill_Martini and JoeStrout like this.
  3. Engkiong

    Engkiong

    Joined:
    May 21, 2017
    Posts:
    2
    Thank you very much methos5k!!!!!!!!!!!!!!!!!!!!!!!!
     
  4. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    no problem :) Happy learning.