Monday, July 6, 2015

Unity Extension Method Tutorial

Check out the code below the videos

In this Unity3D tutorial we learn about extension methods. They're super useful for adding functionality to Unity classes we can't normally edit. We will make a new function for the Vector3 class called toVector2()

Google+ Community:

Support Further Tutorial Development
Check out the videos above to hear the explanation and see the code in action
* Script by Devin Curry
* Please like and subscribe if you found my tutorials helpful :D
* Google+ Community:
* Twitter:
* Facebook Page:
using UnityEngine;
using System.Collections;

public static class ExtensionMethods
 public static Vector2 toVector2(this Vector3 vec3)
  return new Vector2(vec3.x, vec3.y);