Reputation: 19
I just discovered MathF (wonderful tool). Like any new tool, we're going through some... growing pains. I'm working on unit conversion script. Here's my code. I thought MathF.Pow requires two floats, in this case 10 and 6. But apparently that's frowned upon. Any ideas?
Mathf megagram;
void Start () {
megagram = Mathf.Pow(10,6);
Upvotes: 1
Views: 72
Reputation: 1541
float megagram;
void Start ()
{
megagram = Mathf.Pow(10f,6f);
}
If you write 6
or 10
, compiler thinks that you use Int32
. For floats write f
suffix - 6f
, 10f
Also Mathf.Pow
returns float
, not a Mathf
type
Upvotes: 0
Reputation: 33476
Mathf.Pow
returns a float
while you are assigning the return value (float
) to megagram
(MathF
type)
Upvotes: 1