float to string c# unity script Android csharp

Should be quite a straightforward question, seems to be getting out of hand...

I have a float that I update from a plugin on an Android Device, I want to print it out to the screen, simple right?

here is my code: (csharp)

private float       xValue;

xValue  = JNI.CallFloatMethod(JavaClass, JNI.GetMethodID(cls_JavaClass, "getX", "()F"));

String value =  xValue; //.toString() // (String)xValue; // Float.parse(xValue)

and I get errors

Assets/CallJavaCode.cs(48,55): error CS1061: Type `float' does not contain a definition for`toString' and no extension method `toString' of type`float' could be found (are you missing a using directive or an assembly reference?)

I have tried to cast it as a String (String)

I have tried to call the csharp .net .ToString and Float.Parse, Float.TryParse

but it seems float lacks inheritance from a string and does not contain any such type of functions

Now, I am quite confused on this because others have given answers to forum questions saying just use toString(), but I believe Android doesn't have such features (at least .net subset / .net (yes i tried both) )

Documentation seems to be very sparse (maybe I am just spoiled by the depth of MSDN) on what is and isn't included with the .net framework for c# scripting, quite sad really

...but it seems float lacks inheritance from a string...

Actually, ToString is defined in Object, which all types (including int, float etc) derive from. toString doesn't exist, so theres no point attempting that. So you say String value = xValue.ToString(); doesn't work? I find this very odd. Maybe you can try this instead:

String value = String.Format("{0}", xValue);

float.Parse and float.TryParse just attempts to create a float from a string, not the other way around, so it won't do what you want.

ToString is a method that all objects have (yes float is an object, in that definition everything that takes space in memory is an object). all classes and object types in .NET are children of system.object and have ToString either implicit or explicit. i mean even if you don't override it for your class it will have a ToString() that returns the name of your class. so the problem is not in .NET/float side. even the smallest versions like .NET microframework have this feature. maybe because you set it from a Native call it changed it's type to a none dotnet, normal float value (i,e 4 bytes of memory and nothing more) and maybe the value of it is something wrong that could not be converted. i think my first assumption is true due to the eror's message. however i never used unity android or JNI calls.