---
title: "DataTypes"
content_type: tutorial
url: "https://learn.unity.com/course/beginner-scripting/tutorial/data-types?language=en"
language: en
container_type: course
container_title: "Beginner Scripting"
container_url: "https://learn.unity.com/course/beginner-scripting.md?language=en"
standalone_markdown_url: "https://learn.unity.com/tutorial/data-types.md?language=en"
previous_title: "Time"
previous_url: "https://learn.unity.com/course/beginner-scripting/tutorial/delta-time?language=en"
previous_markdown_url: "https://learn.unity.com/course/beginner-scripting/tutorial/delta-time.md?language=en"
next_title: "Classes"
next_url: "https://learn.unity.com/course/beginner-scripting/tutorial/classes-5?language=en"
next_markdown_url: "https://learn.unity.com/course/beginner-scripting/tutorial/classes-5.md?language=en"
difficulty: beginner
duration_minutes: 5
unity_version:
  - "2021.3"
supported_unity_versions:
  - name: "2021.3"
    url: "https://learn.unity.com/course/beginner-scripting/tutorial/data-types.md?language=en&version=2021.3"
last_updated: "2026-10-07T22:10:42.000Z"
---

# DataTypes

Learn how value and reference data types differ so you can reason more accurately about variables in C#.

Learn the important differences between Value and Reference data types, in order to better understand how variables work.

## 1. Data Types

[Video](http://www.youtube.com/watch?v=IVcx-tSxjys)

## **DatatypeScript**

```csharp
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);
    }
}
```
