Add the prefab TextualInteractionSystem to your scene.
Pass it to any script via SerializedField.
Create a TextualInteraction object and use it to start the interaction with StartInteraction() method.
Subscribe to the method with .Subscribe()
Get the result of the interaction in the subscription.
Example
public class TextualInteractionExampleUsage : MonoBehaviour
{
public TextualInteractionManager textualInteractionManager;
void Start()
{
var interaction = new TextualInteraction(
"Do you want to start the quest?",
"Thank you for accepting the quest!",
"Accept",
"Deny",
"Close"
);
textualInteractionManager.StartInteraction(interaction).Subscribe((interactionAnswer) =>
{
if (interactionAnswer)
{
Debug.Log("Player accepted the interaction.");
}
else
{
Debug.Log("Player denied the interaction.");
}
});
}
}
using System; using UnityEngine;
How to use
TextualInteractionSystem
to your scene.TextualInteraction
object and use it to start the interaction withStartInteraction()
method..Subscribe()
Example