这里也是记录一下,防止之后出现类似问题
最近也是在搞工程
根据对话策划案需求,对话需要有自动播放模式
这里对话使用的是NodeCanvas的DialogueTree(可视化挺好用)
这里对话UI使用示例的UI,毕竟播放显示啥的都写好了,也不用在重新做一个UI(这里的中文是我添加的地方)
然后这个需求给我卡住了,我写了很多方法,调用 DialogueTreeController.StartDialogue()都不行,
最后我发现其实只要在UI里的DialogueUGUI修改waitForInput的值就行了,打开就是手动播放,关闭就是播放
于是我就在UI添加按钮作为自动播放的按钮
在按钮里绑定DialogueUGUI的编写的自定义事件OnAutoPlaying()
public void OnAutoPlaying()
{
waitForInput = !waitForInput;
if (waitForInput==false)
{
autoPlayingText.text = "<color=#FF0000>取消自动播放</color>";
}
else
{
autoPlayingText.text = "<color=#323232>自动播放</color>";
}
}
之后就完成了