文档

Unity Engine

Unity Engine

RoundToInt

Converts a Vector2 to a Vector2Int by doing a Round to each value.
阅读时间1 分钟最后更新于 1 个月前

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule

RoundToInt(Vector2)

Converts a Vector2 to a Vector2Int by doing a Round to each value.
public static Vector2Int RoundToInt(Vector2 v)

Parameters

The Vector2 to convert.

Returns

Type

Description

Vector2IntA rounded Vector2Int.

Remarks

As there is a conversion of float to integer, there is a loss of precision.

RoundToInt(Vector2)

Converts a Vector2 to a Vector2Int by doing a Round to each value.
public static Vector2Int RoundToInt(in Vector2 v)

Parameters

The Vector2 to convert.

Returns

Type

Description

Vector2IntA rounded Vector2Int.

Remarks

As there is a conversion of float to integer, there is a loss of precision.