Int to 0. Float

how would I go around about making an int to a float, so for example, i have 1 as int and I want it to be a 0.1 float.

Multiply your int by .1 and cast it into a float? You might have to give more info. Does 15 become 1.5 or .15? Is 145 become 1.45 or 14.5 or .145?

It could be as simple as multiplying by the correct value, or just inserting a decimal into a string.

1 as a float would be 1.0, not 0.1

if you want to convert 1 to 0.1, and 2 to 0.2 then multiply the int by 0.1f, or divide it by 10
But what happens when you get to an integer of 10?

1 Like

I just needed to multiply the int by 0.1f. thanks

int i = 1;

void Start()
{
float f = i * 0.1;
Debug.Log("f : " + f);
}