DataTypes
Tutorial
·
Beginner
·
+10XP
·
5 mins
·
(74)
Unity Technologies

Learn the important differences between Value and Reference data types, in order to better understand how variables work.
Languages available:
1. Data Types
C# DataTypes in Unity! - Beginner Scripting Tutorial
DatatypeScript
using UnityEngine;
using System.Collections;
public class DatatypeScript : MonoBehaviour
{
void Start ()
{
//Value type variable
Vector3 pos = transform.position;
pos = new Vector3(0, 2, 0);
//Reference type variable
Transform tran = transform;
tran.position = new Vector3(0, 2, 0);
}
}