Can't find any such event in here > https://www.pixelcrushers.com/dialogue_ ... pting.html
Closest is OnConversationResponseMenu but it fires when the player is shown the menu
Is there an event which fires when player chooses a response
Re: Is there an event which fires when player chooses a response
Try OnConversationLine. Even if the player's response isn't shown again as a subtitle, OnConversationLine will still be called.
Re: Is there an event which fires when player chooses a response
I wanted to know when the player clicks on a response. Is there a way to know that?
Re: Is there an event which fires when player chooses a response
OnConversationLine will be called when the player clicks on a response. Example:
Another way is to add to the OnClick() event of the response button(s). For example, you could add a script like this:
The code above adds to the OnClick() event in code, but if you prefer you could instead assign it in the inspector.
Code: Select all
public class OnConversationLine(Subtitle subtitle) {
if (subtitle.speakerInfo.isPlayer) Debug.Log("Player chose: " + subtitle.formattedText.text);
}
Code: Select all
public class LogWhenClicked : MonoBehaviour {
void Awake() {
GetComponent<UnityEngine.UI.Button>().onClick.AddListener(OnClick);
}
void OnClick() {
var response = GetComponent<StandardUIResponseButton>().response;
Debug.Log("Clicked: " + response.formattedText.text);
}
}