square unity code example
Example 1: unity square
using UnityEngine;public class Example : MonoBehaviour
{
float f = 2;
float p = 3;
void Start()
{
print(Mathf.Pow(6, 1.8f)); //Return 6 to the power of 1.8
print(Mathf.Pow(f, p)); //Return 2 to the power of 3 which equals 8
}
}
Example 2: how to square root unity
// Mathf.Sqrt(float)
public float a = 9;
Debug.Log(Mathf.Sqrt(a));
// this will print out the sqare root of nine, 3