Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

convert string to float/int

Discussion in 'Project Tiny' started by dallin_unity, Apr 13, 2021.

  1. dallin_unity

    dallin_unity

    Joined:
    Dec 18, 2019
    Posts:
    40
    Hi guys, is there a way to convert string to float/int in tiny? I tried float.Parse, Int32.Parse, int.Parse but I got error when build

    'float' does not contain a definition for 'Parse'
    'int' does not contain a definition for 'Parse'

    Thanks for your help
     
  2. AlexisSphero

    AlexisSphero

    Joined:
    Oct 29, 2020
    Posts:
    12
    I can no longer find the official documentation on this, but Tiny uses a very small subset of C#, based on .NET 2.0 if I remember correctly (I might have that wrong). Anyway, there is no built in way to convert strings to ints or floats. If you need to do that (like I did) then you will need to write your own parse functions.
     
    tonialatalo and dallin_unity like this.