Unity Learn home
View Tutorial Content
Steps

Variables and Functions

Tutorial
Beginner
+10 XP
10 Mins
(8284)
Summary
What are Variables and Functions, and how do they store and process information for us?
This tutorial is included in the Beginner Scripting project.
Select your Unity version
Last updated: November 14, 2023
2019.3
2019.2
2019.1
2018.4
2018.3
2018.2
2018.1
2017.4
2017.3
2017.2
2017.1
5.x
4.x
Language
English
Also included in

1.Variables and Functions

Video Player is loading.
Current Time 0:00
Duration 0:00
Loaded: 0%
Stream Type LIVE
Remaining Time 0:00
 
1x

using UnityEngine; using System.Collections; public class VariablesAndFunctions : MonoBehaviour { int myInt = 5; void Start () { myInt = MultiplyByTwo(myInt); Debug.Log (myInt); } int MultiplyByTwo (int number) { int result; result = number * 2; return result; } }

Variables and Functions
Variables and Functions
General Tutorial Discussion
7
9
1. Variables and Functions
47
22