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

Uncaught Trap with Floats.toString()

Discussion in 'Project Tiny' started by Riverdragon, Jun 11, 2019.

  1. Riverdragon

    Riverdragon

    Joined:
    Jun 22, 2018
    Posts:
    6
    Tested the new C# and you can't directly toString or invoke toString for floats, through ints work just fine. Only occurs with Wasm and AsmJS on 2019.2.0b4.

    Code (CSharp):
    1.  
    2. using Unity.Entities;
    3. using UnityEngine;
    4.  
    5. public class FloatTest: ComponentSystem
    6. {
    7.     protected override void OnUpdate()
    8.     {
    9.  
    10.         float currentTime = 5.95f;
    11.         Debug.Log((int)currentTime);    //Passes with 5
    12.         Debug.Log(currentTime);            //Fails
    13.  
    14.     }
    15. }
    16.  
    I sent in a bug report and now feel silly for posting this as well, my apologies.
     
    Last edited: Jun 11, 2019
    ovirta likes this.
  2. ovirta

    ovirta

    Joined:
    Mar 20, 2015
    Posts:
    42
    Thanks for sharing!
     
  3. Riverdragon

    Riverdragon

    Joined:
    Jun 22, 2018
    Posts:
    6
    ovirta likes this.
  4. kfconeone

    kfconeone

    Joined:
    Oct 3, 2013
    Posts:
    7
    Wow, I just want to send the same bug report yesterday, Thanks for saving me.

    Could someone explain why I can't use the ordinary way to log?