Text adventure game, how to change text in a specific way with C#

Hello! I’m currently trying to develop a “Choose your own adventure” text game.
This is a screenshot of the game:

It is going to have a lot of choices and branching stories depending on the choices you make.
Something like this:

Is it possible to develop a game like this using only 1 scene? I tried in many different ways but can’t seem to get it to work.

Yeah, it’s possible. I would create two scripts: One to store references of the UI components and another script that would act as a story node. The node would contain the text for the message and buttons. Clicking on a button would update the text on the UI components. Nodes would be linked to other nodes.


using UnityEngine.UI;

public class TextAdventureGui : MonoBehaviour {

	public Text   m_text;
	public Button m_button1;
	public Button m_button2;

	public TextAdventureNode firstNode;

	public void Start()

	void ShowNode(TextAdventureNode node)
		m_text.text = node.m_text;
		m_button1.GetComponentInChildren<Text>().text = node.m_button1Text;
		m_button2.GetComponentInChildren<Text>().text = node.m_button2Text;




using UnityEngine.UI;

public class TextAdventureNode : MonoBehaviour {

	public string m_text;
	public string m_button1Text;
	public string m_button2Text;

	public TextAdventureNode m_nextNode1;
	public TextAdventureNode m_nextNode2;