Acem Gaming
  • Home
  • Tutorials
    • Unity Beginner Game Design >
      • Game Design Intro
      • Unity Environment
      • Intro to Visuals
      • Intro to Coding
      • Intro to UI Design
      • Intro to Physics
      • Intro to Materials, Textures, and Lighting
    • Unity C# Tutorials >
      • Beginner >
        • Introduction
        • Variables
        • Operators
        • Conditional Statements
        • Loops
        • Methods
        • Arrays
        • Structures
        • Classes
        • Enumerations
      • Intermediate >
        • Type Conversion
        • Switches
        • Inheritance
        • Encapsulation
        • Polymorphism
        • Static
        • Properties
        • Interfaces
        • Lists
        • Dictionaries
      • Advanced >
        • Delegates
        • Events
        • File IO
        • Stacks
      • DesignPatterns >
        • Proxy
    • Unity Oculus Rift Tutorials >
      • Set-Up
      • Camera Set-up
      • Object Interaction
    • Unity Odds & Ends >
      • Unity UI Tutorial : Healthbar Part 1
      • Unity UI Tutorial: Healthbar Part 2
      • Unity Scriptable Object Tutorial
      • Vector Math
      • Lerp
      • Basics of Motion Physics
      • Unity Physics Basics
      • Clamping Values
      • Linear Physics Movement
    • Legacy Tutorials
  • Game Demos
    • WebGLTest
  • Blog

6 - Methods
While you are programming, there may be parts of your code which you will want to re-use rather than re-writing them.  That is where methods come in.  Methods  allow you to create blocks of code which have some functionality which can easily be used.  In this tutorial I will teach you what makes up a method, and how to use them in your code.
Note:  You may be wondering why methods are called methods instead of functions.  Methods are essentially the OOP version of functions.  There are a few slight differences between them, but for the most part they are the same.
Anatomy of a Method
<Type> <Name> (<Parameters>) { //do stuff code }
Picture
Name
Each method that you create will have a unique name assigned to it.
Parameters
Very often, you will want to pass in variables to a method you create.  Parameters are the variables that you put into the parameter section of your method.
Return
Sometimes you will want to return some value when you call a method.  Return types and the return keyword are how you will achieve this.
Video

Services

Service One
Service Two
Service Three

Company

About
The Company
Menu

Support

Contact
FAQ
Terms of Use
© COPYRIGHT 2015. ALL RIGHTS RESERVED.
  • Home
  • Tutorials
    • Unity Beginner Game Design >
      • Game Design Intro
      • Unity Environment
      • Intro to Visuals
      • Intro to Coding
      • Intro to UI Design
      • Intro to Physics
      • Intro to Materials, Textures, and Lighting
    • Unity C# Tutorials >
      • Beginner >
        • Introduction
        • Variables
        • Operators
        • Conditional Statements
        • Loops
        • Methods
        • Arrays
        • Structures
        • Classes
        • Enumerations
      • Intermediate >
        • Type Conversion
        • Switches
        • Inheritance
        • Encapsulation
        • Polymorphism
        • Static
        • Properties
        • Interfaces
        • Lists
        • Dictionaries
      • Advanced >
        • Delegates
        • Events
        • File IO
        • Stacks
      • DesignPatterns >
        • Proxy
    • Unity Oculus Rift Tutorials >
      • Set-Up
      • Camera Set-up
      • Object Interaction
    • Unity Odds & Ends >
      • Unity UI Tutorial : Healthbar Part 1
      • Unity UI Tutorial: Healthbar Part 2
      • Unity Scriptable Object Tutorial
      • Vector Math
      • Lerp
      • Basics of Motion Physics
      • Unity Physics Basics
      • Clamping Values
      • Linear Physics Movement
    • Legacy Tutorials
  • Game Demos
    • WebGLTest
  • Blog