Skip to content

Instantly share code, notes, and snippets.

@GT3000
Created April 8, 2021 06:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GT3000/661bae1d0b057abbc6af6d1d796debc2 to your computer and use it in GitHub Desktop.
Save GT3000/661bae1d0b057abbc6af6d1d796debc2 to your computer and use it in GitHub Desktop.
Variables Example
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
//Value Types
private int health = 100;
private float speed = 5.0f;
public bool isAlive = true;
//Reference Types
public Transform tran;
private void Start()
{
//These variables are directly changed
health = 0;
speed = 0f;
isAlive = false;
//The variables referenced never change but data they hold the location of does
//The position of transform is never touched but the positon of tran does change from transform since it copied it
tran = transform;
tran.positon = new Vector3(1, 1, 1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment