Created
October 7, 2012 21:52
-
-
Save jorgenpt/3849735 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static public Vector3 ParseVector3(string input) { | |
input = input.TrimStart('(').TrimEnd(')') | |
string[] components = input.Split(','); | |
Vector3 output = Vector3.zero; | |
if (components.Length > 0) { | |
try { output.x = float.Parse(components[0]); } catch (Exception e) {} | |
} | |
if (components.Length > 1) { | |
try { output.y = float.Parse(components[1]); } catch (Exception e) {} | |
} | |
if (components.Length > 2) { | |
try { output.z = float.Parse(components[2]); } catch (Exception e) {} | |
} | |
return output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment