string v = “0,2,3”;
//用分隔符将string分割成数组
string[] vs = v.Split(’,’);
Vector3 v3 = new Vector3();
//然后强制类型转换
v3.x = int.Parse(vs[0]);
v3.y = int.Parse(vs[1]);
v3.z = int.Parse(vs[2]);
把string分成Vector3的x,y,z
最新推荐文章于 2022-01-08 17:33:20 发布
string v = “0,2,3”;
//用分隔符将string分割成数组
string[] vs = v.Split(’,’);
Vector3 v3 = new Vector3();
//然后强制类型转换
v3.x = int.Parse(vs[0]);
v3.y = int.Parse(vs[1]);
v3.z = int.Parse(vs[2]);