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.

[Unity 5] How to display formatted UI text?

Discussion in 'UGUI & TextMesh Pro' started by fabio176, Mar 10, 2015.

  1. fabio176


    Mar 10, 2015
    I'm watching those tutorials on the official website, more specifically, the space shooter project.
    The problem is that I'm using Unity 5, and on the tutorials it uses Unity 4.x which has GUI Text that don't exist anymore (at least not the way it was) on Unity 5. So, I'm having a problem to put a formatted value to be displayed, like we do in C "....%d, %f..." var1, var2...

    I have a gameObject (target) with a script which destroys it when it is touched by the shots. So, in the script I made an int to count: each time an target is destroyed, count++. But I don't know how to "transfer" this var to the UI Text component inside of the canvas to be displayed... How to do it? Thanks.
  2. SimonDarksideJ


    Jul 3, 2012
    Best to watch the new UI tutorials and do a simple conversion. It'll take a while for the tutorials to catch up.
    I did write an article for Unt3DMag for upgrading your GUI but it got pushed back to next month ;-(