So, I’m just trying to make it so I get the new UI text, to a string, how would I go about this? I’ve tried get component ( as seen below)
function Start () {
iptext = GetComponent("Text");
print(iptext);
}
with these results from printing it:
So, it seems to get it for a second… so, what am I doing wrong?
Sbizz
December 4, 2014, 9:51am
2
The Text component has a variable called “text” So you should do
print(iptext.text);
Btw, you should check if iptext is null, just in case.
1 Like
Sbizz:
The Text component has a variable called “text” So you should do
print(iptext.text);
Btw, you should check if iptext is null, just in case.
I get: “text” is not a member of unity engine Component.
Sbizz
December 4, 2014, 10:15am
4
You need to import UnityEngine.UI (I don’t know how you can do that in UnityScript).
Edit:
import UnityEngine.UI;
1 Like
Still getting the compiler error even after importing it.
Sbizz
December 4, 2014, 10:26am
6
Because you’re using a string with GetComponent, try this:
var iptext : Text;
iptext = GetComponent(Text);
1 Like
Sbizz:
Because you’re using a string with GetComponent, try this:
var iptext : Text;
iptext = GetComponent(Text);
Thank you so much for walking me through this, usually I’m a bit more ready for the leap to something new but I just completely missed the jump on this one.