Search Unity

Having a GUI text in an inequality

Discussion in 'Scripting' started by Bobbbbil, Feb 3, 2013.

  1. Bobbbbil

    Bobbbbil

    Joined:
    Jan 10, 2013
    Posts:
    49
    Hey, I have a GUI text that keeps the score of when I destroy an object. Is there a way to have an eniquality that is like, if gui text is > 0 then I can activate another script? I know I need an if statement so just need to know how to write the GUI text so its greater than 0. Thank you
     
  2. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,250
    You will probably have to convert your string to an int or float
     
  3. Bobbbbil

    Bobbbbil

    Joined:
    Jan 10, 2013
    Posts:
    49
    Ok so make the GUI text script that shows the score for example "score" and then in the eniquality say, if score > 0 then the other script can work?

    Thanks:)
     
  4. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,250
    Yes, just use your score variable is the ideal way :)
     
  5. Bobbbbil

    Bobbbbil

    Joined:
    Jan 10, 2013
    Posts:
    49
    Awesome:) Will try this out and let you know the results! Thanks:)