Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question I Cant Make Math

Discussion in 'Scripting' started by GamerBurakYoutuber, Feb 21, 2021.

  1. GamerBurakYoutuber

    GamerBurakYoutuber

    Joined:
    Jun 10, 2020
    Posts:
    7
    The title is weird,
    Code (CSharp):
    1.             if (ScoreHeightMinus < -9.5)
    2.             {
    3.                 ScoreHeightMinus = -9.5;
    4.             }
    its if the ScoreHeightMinus float are < than -9.5 , make it -9.5. but i cant make math because its count numbers are doubles.
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,722
    You need to write them as float literals by adding `f` at the end:
    9.5f
     
    GamerBurakYoutuber likes this.
  3. GamerBurakYoutuber

    GamerBurakYoutuber

    Joined:
    Jun 10, 2020
    Posts:
    7
    Thank You!