以下の内容はhttps://baba-s.hatenablog.com/entry/2018/03/14/164900より取得しました。


【Unity】Vector2 を四捨五入する拡張メソッド

ソースコード

using UnityEngine;

public static class Vector2Ext
{
    public static Vector2 Round( this Vector2 self )
    {
        return new Vector2
        (
            Mathf.Round( self.x ),
            Mathf.Round( self.y )
        );
    }
}

使い方

var vec = new Vector2( 1.1f, 1.1f );
vec = vec.Round();



以上の内容はhttps://baba-s.hatenablog.com/entry/2018/03/14/164900より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14