public static class Vector3Extensio {
public static Vector2 Round(this Vector3 v){
int x = Mathf.RoundToInt (v.x);
int y = Mathf.RoundToInt (v.y);
return new Vector2 (x, y);
}
}
Vector2 pos = child.position.Round ();这里的round为什么可以调用上面的round方法
因为Vector3Extesions类是Vector3类的扩展类,其中Extesions写法是一个固有写法,
你可以参考一下以下的文章,你也可以试试这样写,这样跨dll都可以调用Vector3的Ex的方法了。
https://www.cnblogs.com/multiplesoftware/archive/2011/10/13/2209603.html