float to vector2 c++ code example
Example: how to contvert a vector2 into a float
using UnityEngine;
using System.Collections;
public class Move : MonoBehaviour {
public Vector2 mouse2;
public float x;
void Update()
{
mouse2 = Input.mousePosition;
x = mouse2.x;
}
}
As you can see, I first had to make a new public float next to my new vector2,
and then under the void update I made the floats value = the value of X in mouse2.