Advertisement
Guest User

Ayyyy

a guest
Jun 26th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.52 KB | None | 0 0
  1. public string Vector3ToString(Vector3 vector)
  2. {
  3.     /* An output string might look like */
  4.     /* 150,250,0 */
  5.     return (string.Format("{0},{1},{2}", vector.x, vector.y, vector.z));
  6. }
  7.  
  8. public Vector3 StringToVector3(string vector)
  9. {
  10.     /* Split the string into a series of string, seperated by the comma */
  11.     string[] components = vector.Split(',');
  12.  
  13.     /* Parse the strings into ints and insert those as the Vectors X/Y and Z */
  14.     return new Vector3(int.Parse(component[0]), int.Parse(component[1]), int.Parse(component[2]));
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement