Answers for "how to contvert a vector2 into a float"

1

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.
Posted by: Guest on March-14-2021

Code answers related to "how to contvert a vector2 into a float"

Browse Popular Code Answers by Language