- Home /
It was a dumb question...
Dialouge isnt working
Hey! as the title said im trying to make a game where it pops up a dialouge when i start the game. But when i press the buttons nothing happens. i have put in the OnClick() on the button objects. it seems to be a problem with the buttons because the load scene thing isnt working either. The public strings is probably not needed? but it looks cool my script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;
public class Talk : MonoBehaviour {
public GameObject DialougeObj;
public Text Question;
public Text Answear1;
public Text Answear2;
public Text Answear3;
public string QuestionString;
public string Answear1String;
public string Answear2String;
public string Answear3String;
void Start()
{
Answear3.gameObject.SetActive(false);
QuestionString = "Do you want to play the tutorial?";
Answear1String = "Yes!";
Answear2String = "No!";
}
void Update()
{
Question.text = QuestionString;
Answear1.text = Answear1String;
Answear2.text = Answear2String;
Answear3.text = Answear3String;
}
public void Answear1Butt()
{
Answear2.gameObject.SetActive(false);
Answear3.gameObject.SetActive(false);
QuestionString = "Use WASD to move" +
"1 for pistol, 2 sword, 3 for weapon3" +
"Easy right?, now play the tutorial map and then through the portal!";
Answear1String = "Yes, sir!";
}
public void Answear2Butt()
{
DialougeObj.SetActive(false);
SceneManager.LoadScene("Main World");
}
}
Answer by W01Fi3 · Oct 15, 2018 at 09:05 PM
@TvattSvampen Are the buttons working at all, do you have an EventSystem in your scene?
@W01Fi3 I have a eventSystem, but i dont know how to use it or what it does. ive used buttons before noproblem. and the buttons highlight color works
EDIT: i dont know what i did but now, the loadscene works but the text isnt changeing?
Edit: everything worked i just needed for somereason to press buttons twice bc of fps controller?? really weird
Follow this Question
Related Questions
Visual Novel Events 0 Answers
Changing Button sprite using OnGui method 0 Answers
How do you access the Blocking Mask of GraphicsRaycaster in code? 2 Answers
Button Scroll view original default button becoming clone 0 Answers
Resource Counting 1 Answer