How can i parse a string into an int in unity3d? im using javascipt but i guess i need to use a .net function?
http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=javascript+string+to+int
parseInt(string) and parseFloat(string) should work fine.
example:
intVar = parseInt(stringVar);
ah, thx very much
Use TryParse if there’s any chance the string will have non-numeric stuff in it.
–Eric
As far as I know, Javascript has no TryParse equivalent.
Here is a link to a page where someone wrote a similar function though:
int.TryParse() works fine in Unity’s Java Script.
Your link refers to a site about conventional Java Script, which has very little relevance to Unity.
Ahh, good to know ![]()