Show Twison Node-Name(Title) in update void
Show Twison Node-Name(Title) in update void
Hello. We use Twison import for create a story. Which sript should i write in Unity for show the name(title) of current Twine node during the conversation? I need to get "Begin" in unity update
- Attachments
-
- Screenshot_2.png (13.22 KiB) Viewed 564 times
Re: Show Twison Node-Name(Title) in update void
Hi,
If you're using an OnConversationLine() method, you can use the Subtitle object passed to the method:
Otherwise you can use DialogueManager.currentConversationState:
If you're using an OnConversationLine() method, you can use the Subtitle object passed to the method:
Code: Select all
void OnConversationLine(Subtitle subtitle)
{
Debug.Log("Title of current line is: " + subtitle.dialogueEntry.Title);
}
Code: Select all
Debug.Log("Title of current line is: " + DialogueManager.currentConversationState.subtitle.dialogueEntry.Title);
Re: Show Twison Node-Name(Title) in update void
Thank you. i 'll check that
Re: Show Twison Node-Name(Title) in update void
Glad to help!
Re: Show Twison Node-Name(Title) in update void
Yes, it works in some manner. But I am interested in next case:
When I atach function to current node, that function must show me the title of current node(Using DialogueManager.currentConversationState.subtitle.dialogueEntry.Title), but it shows me the Title of previous node.
- Attachments
-
- Screenshot_5.png (103.61 KiB) Viewed 320 times
Re: Show Twison Node-Name(Title) in update void
Hi,
An immediate solution is to wait until the end of the frame:
In version 2.2.22 and earlier, the idea is that the Scene Events are run to prepare the node for display. The node isn't actually being displayed yet, so DialogueManager.currentConversationState hasn't been set to that node.
However, I think it may work better for most users to update DialogueManager.currentConversationState before running the Scene Events. I will evaluate this for version 2.2.23 and consider changing the behavior. In any case, if you use the code above it will work fine even if the behavior changes.
An immediate solution is to wait until the end of the frame:
Code: Select all
public class GameController
{
public void change....()
{
StartCoroutine(CheckTitleAtEndOfFrame());
}
IEnumerator CheckTitleAtEndOfFrame()
{
yield return new WaitForEndOfFrame();
string title = DialogueManager.currentConversationState.subtitle.Title;
}
However, I think it may work better for most users to update DialogueManager.currentConversationState before running the Scene Events. I will evaluate this for version 2.2.23 and consider changing the behavior. In any case, if you use the code above it will work fine even if the behavior changes.
Re: Show Twison Node-Name(Title) in update void
Thank you) It works
Re: Show Twison Node-Name(Title) in update void
Glad to help!