Question by
Eagle-Bound · Oct 20, 2016 at 10:33 PM ·
c#buttontext
Pick your path text adventure
I've started making a really basic pick your path type text adventure, and I've got most of it working. My only problem is if you pick the first button, or option, I can't figure out how to access the other button.
If anyone knows how I could go about it, it would be very helpful.
(I have another very similar one for the other button).
Thanks!
My script:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class ButtonOne : MonoBehaviour {
public Text mainText;
public Text option1Text;
public Text option2Text;
private bool secondBool;
private bool fithBool;
private bool sixthBool;
private bool one;
public Button button1;
public void OnButtonUp(){
secondBool = true;
if (secondBool == true) {
if (one == true) {
sixthBool = true;
}
}
}
void Update () {
if(secondBool == true){
mainText.text = "Text 2";
option1Text.text = "Option 1";
option2Text.text = "Option 2";
one = true;
if(sixthBool == true){
mainText.text = "Text 3";
option1Text.text = "More Option 1";
option2Text.text = "More Option 2";
}
}
if (sixthBool == true) {
mainText.text = "Branched";
option1Text.text = "More Branch Option 1";
option2Text.text = "More Branch Option 2";
}
}
}
Comment
Your answer
Follow this Question
Related Questions
how can i make the name of a clicked button appears as text in another scene 1 Answer
Making text appear by pressing a button, only when player is close to the object 1 Answer
Text adventure game, how to change text in a specific way with C# 1 Answer
How To Load TTF Font From External File 0 Answers
How to link up instantiated text in list to allow buttons to adjust number shown, c# 1 Answer