- Home /
how to convert a float to string[]
hello
sorry i am new to unity and i want to know how to convert from float to string[]
the thing is when i use "ToString" command it gives me that you cannot convert string to string[]
here is my line of code:
InXMLGui.excWaypointX1st = transform.position.x.ToString();
i am using C# thank you
Comment
Answer by Dave-Carlile · Jul 11, 2015 at 02:18 PM
What is the data type for excWaypointX1st
? It's a string array I assume? If you're trying to assign a value to a position in the array then you have to specify an index...
InXMLGui.excWaypointX1st[0] = transform.position.x.ToString();
That will assign the value to the first position in the array. If you're just wanting to save a single value then your excWaypointX1st
property should be just a string data type, not a string array.