Search Unity

Problem with Score- problem with converting

Discussion in '2D' started by KiviGameMaker, Mar 24, 2018.

?

Decimal Point

  1. everzone

    0 vote(s)
    0.0%
  2. everyone

    0 vote(s)
    0.0%
Multiple votes are allowed.
  1. KiviGameMaker

    KiviGameMaker

    Joined:
    Mar 18, 2018
    Posts:
    22
    Hello guys i have problem with Score show.
    When I set the value to 1, the score is in 1 second of 100. And here's the problem. I need to set the value to 0.01 or 0.1. I tried to convert the value (int) 0.01 but the display value was 0. I

    Another problem is if I set the value to float, so we see a decimal point, and I want the value to be displayed only in integers.

    SCREENSHOOT:
    https://imgur.com/a/rvgwD

    may be wrong to think and the problem is in me. I need your help. Thank you for every answer.
    Here is my CODE:
    https://gist.github.com/KiviMaker/b07b45ff8f99c7fdd26e178f1f15e259
     
  2. FabDynamic

    FabDynamic

    Joined:
    Jul 31, 2017
    Posts:
    36
    Change this line
    Code (CSharp):
    1. score1.text = ("Score " + score);
    To this
    Code (CSharp):
    1. score1.text = ("Score " + Mathf.RoundToInt( score ));
    That should do the trick!
     
  3. KiviGameMaker

    KiviGameMaker

    Joined:
    Mar 18, 2018
    Posts:
    22
    Than you very much <3