floor whole vector 3 unity code example

Example 1: round vector3 unity

static class ExtensionMethods {     /// <summary>     /// Rounds Vector3.     /// </summary>     /// <param name="vector3"></param>     /// <param name="decimalPlaces"></param>     /// <returns></returns>     public static Vector3 Round(this Vector3 vector3, int decimalPlaces = 2)     {         float multiplier = 1;         for (int i = 0; i < decimalPlaces; i++)         {             multiplier *= 10f;         }         return new Vector3(             Mathf.Round(vector3.x * multiplier) / multiplier,             Mathf.Round(vector3.y * multiplier) / multiplier,             Mathf.Round(vector3.z * multiplier) / multiplier);     } }

Example 2: round vector3 unity

vector3 = new Vector3(1.23243f, 2.213124f, 12.4123f);
 var roundedVector3 = vector3.Round(1);