Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 704 Bytes

README.md

File metadata and controls

36 lines (27 loc) · 704 Bytes

Overview

This repository contains Deconstructing Unity classes/structs with extension methods.

Supported classes/structs are as bellow:

  • Vector
    • Vector2
    • Vector2Int
    • Vector3
    • Vector3Int
    • Vector4
  • Quoaternion
  • Color
    • Color
    • Color32
  • Rect

Hot to use

//Deconstruct Vector3
var (x, y, z) = new Vector3(1,1,1);

//Deconstruct Color
var (r, g, b, a) = new Color(1, 1, 1);

Also, you can convert to tuple explicitly if you concern order of return values.

// Visual Studio dialog an explanation of return values.
var (x, y, z) = Vector3.one.ToTuple();

var(r, g, b, a) = Color.red.ToTuple();