Variable data type for two ints (x and y) in inspector

Is there a type of variable you can use that appears like a Vector2 in the inspector, but for ints only? So the inspector displays two values on the same line beside each other, but they’re only ints, not floats.

I’d like to not have to convert the floats to ints at runtime, and it’d be handy to not just have two separate int values. Thanks!

Make a type Vector2i that looks something like:

struct Vector2i {
    int x, y;

    public Vector2i(int x, int y) { this.x = x; this.y = y; }
}

and mark it Serializable:

[Serializable]
public Vector2i SomeIntVector;

If i were you I’d simply do a public Vector2 and only write ints in it. If you are talking for editor scripting there are other ways, but if not simply convert the floats to ints in the start (that should work)… since the inspector is set obviously before playing.

Other than that, no you can’t, sorry.

You can use Vector2Int instead of Vector2