- Home /
Question by
tekunana95 · Dec 12, 2017 at 01:42 AM ·
textarrays
how to assign string value of an array into gameobject text?
I need to assign value from my array into gameobject text, but i dont have any idea on how to do it?
Comment
What is a "gameobject text"? A UI.Text component?
Have you tried something like:
myTextComponent.text = myArray[0];
It would help if you provided your current code.
Answer by Ginxx009 · Dec 12, 2017 at 02:00 AM
You mean something like this .
publlic GameObject[] UItext;
then you will use it like this
void Start(){
foreach(GameObject uis in UItext){
uis.gameObject.GetComponent<Text>();
}
}
I hope it helps you.
Your answer
![](https://koobas.hobune.stream/wayback/20220612144421im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
displaying text typed in 1 Answer
Display text on gameobject via user inputs 1 Answer
Accessing/Initializing array that's part of a class. 1 Answer
How to take the text from a rich text input field and save each line into an array 1 Answer
How to populate an array from an external text file 1 Answer