把string分成Vector3的x,y,z

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]);

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章