Unity Learn home
View Tutorial Content
Steps

[Archive] Coding in Unity for the Absolute Beginner

Tutorial
Beginner
1 Hour10 Mins
(273)
Summary
This recorded live session from October 2014 introduces coding in C# to the absolute beginner. The session includes a discussion of the very basics of coding, including variables, functions and classes, and how to use them. Also covered are some of the most common of Unity's built in functions, when to use them, and when to write your own.
Select your Unity version
Last updated: December 21, 2021
4.x
Language
English

1.Coding in Unity for the Absolute Beginner - October 2014 Live Training

This content is hosted by a third party provider that does not allow video views without acceptance of Targeting Cookies. Please set your cookie preferences for Targeting Cookies to yes if you wish to view videos from these providers.
Type caption for embed (optional)

DemoScript [Revision 1]
using UnityEngine; using System.Collections; public class DemoScript : MonoBehaviour { public Light myLight; void Update () { if (Input.GetKey ("space")) { myLight.enabled = true; } else { myLight.enabled = false; } } }
DemoScript [Revision 2]
using UnityEngine; using System.Collections; public class DemoScript : MonoBehaviour { public Light myLight; void Update () { if (Input.GetKeyDown ("space")) { myLight.enabled = true; } if (Input.GetKeyUp ("space")) { myLight.enabled = false; } } }
DemoScript [Revision 3]
using UnityEngine; using System.Collections; public class DemoScript : MonoBehaviour { public Light myLight; void Update () { if (Input.GetKeyDown ("space")) { myLight.enabled = !myLight.enabled; } } }
DemoScript [Revision 4]
using UnityEngine; using System.Collections; public class DemoScript : MonoBehaviour { public Light myLight; void Update () { if (Input.GetKeyDown ("space")) { MyFunction (); } } void MyFunction () { myLight.enabled = !myLight.enabled; } }
DemoScript [Revision 5]
using UnityEngine; using System.Collections; public class DemoScript : MonoBehaviour { public Light myLight; void Awake () { int myVar = AddTwo(9,2); Debug.Log(myVar); } void Update () { if (Input.GetKeyDown ("space")) { MyFunction (); } } void MyFunction () { myLight.enabled = !myLight.enabled; } string AddTwo (int var1, int var2) { int returnValue = var1 + var2; return returnValue; } }
DemoScript [Revision 6]
using UnityEngine; using System.Collections; [System.Serializable] public class DataClass { public int myInt; public float myFloat; } public class DemoScript : MonoBehaviour { public Light myLight; public DataClass[] myClass; void Awake () { int myVar = AddTwo(9,2); Debug.Log(myVar); } void Update () { if (Input.GetKeyDown ("space")) { MyFunction (); } rigidbody.velocity = 10.0f; } void MyFunction () { myLight.enabled = !myLight.enabled; } string AddTwo (int var1, int var2) { int returnValue = var1 + var2; return returnValue; } }

[Archive] Coding in Unity for the Absolute Beginner
[Archive] Coding in Unity for the Absolute Beginner
General Tutorial Discussion
0
2
1. Coding in Unity for the Absolute Beginner - October 2014 Live Training
3
6