Modify a text object using script
Hi, im trying to create a quizz for android but im new here and i dont know much about C#. I want to change the text using a script . My text object is called "TextQuestion" I've try many different code which i found on the forum but nothing work.Can you please help me and explain me how to do this and please comment the code so i understand it would be very nice. ^^ I have already try this code but it didnt work
using UnityEngine;
using UnityEngine.UI;
public class ChangerQuestion : MonoBehaviour {
public GameObject ChangeQuestion;
void Start ()
{
Text question;
question.text = "Hello";
}
}
Sorry for my bad english
I don't want to write your code for you, because that's not really what Unity Answers is for. I will point something out though.
You need a reference to the Text component of your TextQuestion GameObject.
As far as I can tell, your scene currently has 4 Text objects. One for the question, and one for each of the answer buttons. Yes? Your script needs to know which of these four objects you want to deal with.
Answer by danidu93 · Feb 25, 2016 at 04:48 PM
Thank you for your answer i will try to reference the Text component ^^
Your answer
Follow this Question
Related Questions
Object reference not set to instance for my timer and my text 0 Answers
Unity {[(2D)]} RotateAround while jumping 0 Answers
How do i make my enemies face the player? 2D 0 Answers
error CS0246 1 Answer
Please Help With Script 1 Answer