- Home /
Question by
JackoMiG · Jul 10, 2015 at 06:11 PM ·
javascriptuivariableguitext
How do I reference a UI text in Unity 5? (JS)
Hi, I was using gui texture before upgrading to Unity 5 however they no longer work (and were pretty crappy anyway).
I'm not sure what the correct variable type the UI texture is in javascript ("Text" isn't working)
var gui_ClipCount : Text;
How would I reference a UI text in a variable USING JAVASCRIPT?
Comment
Best Answer
Answer by JackoMiG · Jul 10, 2015 at 06:12 PM
Wow facepalm.
Unity even TOLD me what it was. It's UI.Text, so it should be:
var gui_ClipCount : UI.Text;
Answer by Gigiga · Jul 11, 2015 at 12:23 PM
Try using
import UnityEngine.UI;
at the beginning of your script. It saves you writing UI.* all the time.
Your answer
![](https://koobas.hobune.stream/wayback/20220611230719im_/https://answers.unity.com/themes/thub/images/avi.jpg)