Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Project tiny C# "string" BUG

Discussion in 'Project Tiny' started by oceanxiao, Jun 30, 2019.

  1. oceanxiao

    oceanxiao

    Joined:
    Jan 19, 2016
    Posts:
    10
    upload_2019-6-30_23-53-53.png
    protected string MyFloatToString(float v)
    {
    return Unity.Tiny.Debugging.NumberConverter.FloatToString(v);
    }

    Here is the outputs in chrome Devtools:
    upload_2019-6-30_23-53-25.png
    I cannot find a way to output log correctly. Because Unity.Tiny.Debugging.LogFormat can only used in debug mode, I use console.writeline. But concat values in one string in order to output within same line seems to be a BUG?
     
  2. Frickinlaser

    Frickinlaser

    Joined:
    Jan 19, 2014
    Posts:
    22
    You can use string interpolation with the $ - character. Like this:
    Code (CSharp):
    1. var x = 1;
    2. var y = 2;
    3. Console.WriteLine($"Position {x}:{y}");
     
  3. oceanxiao

    oceanxiao

    Joined:
    Jan 19, 2016
    Posts:
    10
    No, it does not work. Here is my code:
    upload_2019-7-1_20-40-9.png

    Outputs in Devtools:
    upload_2019-7-1_20-42-1.png

    I'm using unity 2019.2.0b4 and sample's building mode is "AsmJS Release".
     
  4. Frickinlaser

    Frickinlaser

    Joined:
    Jan 19, 2014
    Posts:
    22
    Yeah, you're right. I hadn't built with AsmJS before. Just been using dotnet and it works there.
     
  5. Thaina

    Thaina

    Joined:
    Jul 13, 2012
    Posts:
    399
    Also don't work in wasm
     
unityunity