'Float to String' bug when compiling to iOS

Mafradan 4 years ago updated by Lazlo Bonin (Lead Developer) 4 years ago 8 1 duplicate


I found a bug trying to convert a float to a string: when you compile it to Pc/Mac all is fine but if you try to compile it in xCode it fails the building process.

To prove it I prepared a simple project in Unity with a very elementary graph. When you build it with the "float to string" unit it doesn't work (in iOS, I mean), if you remove that unit all goes fine.

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):

Duplicates 1

Pending Review

Thanks for investigating this bug down to the C++ source.

Can you paste the error that the C++ compiler outputs?

This seems like an IL2CPP bug, but I want to make sure before forwarding to the Unity team.

this one, you mean?

No, I mean the C++ error itself.

You say the compiler highlights the line in your first screenshot (String_t*...). What is the error associated with that line?

the compiler doesn't show up an error, actually: simply the debugger hangs on this line even if I try to ignore the 'warning'...


Found the cause. CreateDelegate on instance members of value types generates invalid IL code unless a new byref delegate type is created, but Unity's Mono version has a bug that prevents this new type of delegate from working. (Whew.)

I'll fix it by disabling optimization on instance methods of value types in the mean time.