How do I convert y x Axis to a int

just dont know how to make this a int instead of a float

public Vector3[] positionArray = new [] { new Vector3(0f,0f,0f), new Vector3(1f,5f,5f) };

void Start()
{
    float TimeBeforStat = positionArray[0].z; //how do i make this a int
}

2 Answers

2

Mathf.RoundToInt();

thanks man but just so it makes sense to others im gana do this int ships = Mathf.RoundToInt(positionArray[currentPos].x);

–

Multiple ways to convert a float to an int. Choose any of the code lines below as appropriate.

(int)myFloat;
Mathf.RoundToInt(myFloat);
Mathf.CeilToInt(myFloat);
Mathf.FloorToInt(myFloat);

You've got an FlooToIng there! Incase someone is getting errors using it, it was meant to be FloorToInt :D

–

thanks man its a bit confusing but the other guy did answer first so sorry lol

–

I have a custom function in my code called FlooToIng. And a custom wrapper class called MathF... Okay, so my answer was full of typos. Fixed now.

–