var joe = “string”;
or
var joe= 1;
Can I tell which one is the string by using some “Type” command that would output the variable type?
Is there a property that tells the type?
Thanks,
Dan
var joe = “string”;
or
var joe= 1;
Can I tell which one is the string by using some “Type” command that would output the variable type?
Is there a property that tells the type?
Thanks,
Dan
Try
if (joe == joe+"")
or
if (joe == joe.ToString())
There is also a Type class you can try, but for your needs I think one of the above will suffice.
if(joe.GetType()==System.String) seems to work
although GetType is not listed anywhere.
if (typeof(joe) == String)
GetType, typeof, etc. are all listed in the .NET docs along with all other language features.
–Eric
Unity should include some set of .net guide in their docs. At least a list of which ones are available with javascript examples. Someone should write a definitive Unity3d programming book that includes javascript examples for all the .net library features.
Dan
Well, it’s all on msdn.microsoft.com (though it’s not exactly a fun read). Pretty much anything JSCRIPT can do, Unityscript can do.