[Articy] Nico Probst wrote:Hi shanehou,
The "End" is not always the same for each project. For example in our Demo Project a Dialogue has reached its end when all branches are not of the DialogueFragment type anymore, then we hide the Dialogue UI.
But the easiest is just checking if the list of branches is empty, that will tell you that you reached the end of your flow. Or do you need something different?
Best regards
Nico
Hi Nico,
To check the numbers of the branch list was my first attempt, but I found it had some interesting behaviours. Below is part of the code I'm using:
- Code: Select all
public void OnBranchesUpdated(IList<Branch> aBranches)
{
string branchName = "-1";
if (aBranches.Count > 0)
{
branchName = aBranches[0].DefaultDescription;
}
Debug.Log("OnBranchesUpdated " + branchName + " branch cnt " + aBranches.Count);
}
public void Init(ArticyObject flowObj = null)
{
if (flowObj != null)
{
ArticyFlowPlayer flowPlayer = GetComponent<ArticyFlowPlayer>();
flowPlayer.StartOn = flowObj;
flowPlayer.Play();
}
}
So basically for the first attempt of running the Articy flow, the debug message would always be:
- Code: Select all
OnBranchesUpdated -1 branch cnt 0
I have also made some debug code for advancing the flow, the other outputs looked correct though. To the end of the flow, the message above showed again as what you've said. I tried to keep running the flow and found other messages like below:
- Code: Select all
OnBranchesUpdated 0x100000000001168 branch cnt 1
OnBranchesUpdated 0x100000000001168 branch cnt 1
OnBranchesUpdated 0x100000000001168 branch cnt 1... (same results)
Since the count of the branch list is always zero at the first attempt of running the flow, it seems not possible to check if the flow reaches its end by using this method. I'm wondering if that's a bug or not?
My flow below:
https://i.imgur.com/1iOOHl4.png