How to do this in unity

You gave an example that in unity to reverse power you type in:

Debug.Log("Test: " + MathF.Pow(4096, 1/3));

I have tried that but the result I am getting is not 16 but:

Test: 1

Any idea what could be the issue? I am using Unity 2021.3.16f1

Thanks

Laco

Probably because you are using integer division. 1/3 = 0 but 1/3f = 0.3333333f
Try

Debug.Log("Test: " + Mathf.Pow(4096, 1/3f));

Thank you @bixarrio you are correct.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms