# String to GUI Text??

**URL:** https://discussions.unity.com/t/string-to-gui-text/468236
**Category:** Scripting
**Tags:** Scripting
**Created:** [February 15, 2012, 8:04pm UTC](https://discussions.unity.com/t/string-to-gui-text/468236 "2012-02-15T20:04:42Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![All\_American](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/all_american/32/158550_2.png) [@All\_American](https://discussions.unity.com/u/All_American)
#### Post date: [February 15, 2012, 8:04pm UTC](https://discussions.unity.com/t/string-to-gui-text/468236/1 "2012-02-15T20:04:42Z")

</div>

I am trying to get a refernce of a number to display with GUI text, I am getting an error-

“Cannot implicitly convert type `string' to `UnityEngine.GUIText”

```auto
/
/
/
public GUIText Roundsleft;
	
	void UpDate() 
	{
	Roundsleft = (Player.RoundsLeft).ToString("Rounds Left:");
	}
/
/
/

```

How else would I do this???

---

<div class="post-metadata">

### Author: ![GargerathSunman](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/gargerathsunman/32/185234_2.png) [@GargerathSunman](https://discussions.unity.com/u/GargerathSunman)
#### Post date: [February 15, 2012, 8:08pm UTC](https://discussions.unity.com/t/string-to-gui-text/468236/2 "2012-02-15T20:08:58Z")

</div>

Roundsleft.text = (Player.RoundsLeft).ToString(“Rounds Left:”);

---

<div class="post-metadata">

### Author: ![anon\_31134026](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@anon\_31134026](https://discussions.unity.com/u/anon_31134026)
#### Post date: [February 15, 2012, 8:09pm UTC](https://discussions.unity.com/t/string-to-gui-text/468236/3 "2012-02-15T20:09:45Z")

</div>

Roundsleft.text

is what you’re looking for.

---

<div class="post-metadata">

### Author: ![All\_American](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/all_american/32/158550_2.png) [@All\_American](https://discussions.unity.com/u/All_American)
#### Post date: [February 15, 2012, 8:20pm UTC](https://discussions.unity.com/t/string-to-gui-text/468236/4 "2012-02-15T20:20:17Z")

</div>

Tried it, the numbers are not showing.

Thanks

---

<div class="post-metadata">

### Author: ![GargerathSunman](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/gargerathsunman/32/185234_2.png) [@GargerathSunman](https://discussions.unity.com/u/GargerathSunman)
#### Post date: [February 15, 2012, 8:22pm UTC](https://discussions.unity.com/t/string-to-gui-text/468236/5 "2012-02-15T20:22:31Z")

</div>

That’s because your code for what you display doesn’t seem to be correct either, not just the link to the text variable.

Roundsleft.text = "Rounds Left: " + Player.RoundsLeft.ToString();

---

<div class="post-metadata">

### Author: ![All\_American](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/all_american/32/158550_2.png) [@All\_American](https://discussions.unity.com/u/All_American)
#### Post date: [February 15, 2012, 8:26pm UTC](https://discussions.unity.com/t/string-to-gui-text/468236/6 "2012-02-15T20:26:03Z")

</div>

That didn’t do it either, I tried that before, But I didn’t have the .text in there. This works with a GUI Label, but I want to be able to control where it is seen…

---

<div class="post-metadata">

### Author: ![GargerathSunman](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/gargerathsunman/32/185234_2.png) [@GargerathSunman](https://discussions.unity.com/u/GargerathSunman)
#### Post date: [February 15, 2012, 8:31pm UTC](https://discussions.unity.com/t/string-to-gui-text/468236/7 "2012-02-15T20:31:50Z")

</div>

If it’s a GUIText object, you can move it around on the screen. You can also use a GUI.Label that gives you an exact control of what pixels on screen show the label.

---

<div class="post-metadata">

### Author: ![All\_American](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/all_american/32/158550_2.png) [@All\_American](https://discussions.unity.com/u/All_American)
#### Post date: [February 15, 2012, 8:36pm UTC](https://discussions.unity.com/t/string-to-gui-text/468236/8 "2012-02-15T20:36:14Z")

</div>

I know, but the GUI Text isn’t showing the numbers like the label, and the label is on every camera and I was told that you can not stop the rendering on OnGUI labels.

---

<div class="post-metadata">

### Author: ![All\_American](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/all_american/32/158550_2.png) [@All\_American](https://discussions.unity.com/u/All_American)
#### Post date: [February 15, 2012, 8:47pm UTC](https://discussions.unity.com/t/string-to-gui-text/468236/9 "2012-02-15T20:47:17Z")

</div>

I got it to show, by putting it in the start function but it isn’t counting down on firing??

---

<div class="post-metadata">

### Author: ![All\_American](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/all_american/32/158550_2.png) [@All\_American](https://discussions.unity.com/u/All_American)
#### Post date: [February 15, 2012, 8:53pm UTC](https://discussions.unity.com/t/string-to-gui-text/468236/10 "2012-02-15T20:53:55Z")

</div>

I go it to work, by putting it in OnGUI, I didn’t realize I had to do that with GUIText…

---

<div class="post-metadata">

### Author: ![renman3000](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/renman3000/32/595476_2.png) [@renman3000](https://discussions.unity.com/u/renman3000)
#### Post date: [February 15, 2012, 8:59pm UTC](https://discussions.unity.com/t/string-to-gui-text/468236/11 "2012-02-15T20:59:23Z")

</div>

Your Update was UpDate

---

<div class="post-metadata">

### Author: ![All\_American](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/all_american/32/158550_2.png) [@All\_American](https://discussions.unity.com/u/All_American)
#### Post date: [February 15, 2012, 9:13pm UTC](https://discussions.unity.com/t/string-to-gui-text/468236/12 "2012-02-15T21:13:57Z")

</div>

Good eye, thanks, now it works in Update…🙂

---

<div class="post-metadata">

### Author: ![renman3000](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/renman3000/32/595476_2.png) [@renman3000](https://discussions.unity.com/u/renman3000)
#### Post date: [February 15, 2012, 9:18pm UTC](https://discussions.unity.com/t/string-to-gui-text/468236/13 "2012-02-15T21:18:48Z")

</div>

🙂 eagle eye they call meh. 🙂
