How the branchs in IArticyFlowPlayerCallbacks is ordered?

Mon 4. Dec 2017, 18:12

While running in Articy we always have answers in vertical aligned order - as see it in Articy flow so i see in preview. But in Unity we have unpredictible branch ordering.
Here is also sample articy flow - https://monosnap.com/file/o2CCJiXo66kDKQ1l9YrK5KB1MNnbfq (link to image service becouse of forum image size limits to 800px):
- In Articy presentation we have branch order 1,2,3,4.
- In Unity we have branch order - 3,1,2,4.

Is here some documentation or rules of ordering for IArticyFlowPlayerCallbacks.OnBranchesUpdated(IList<Articy.Unity.Branch>) method?
User avatar
misterionkell
 
Posts: 37
Joined: Mon 8. May 2017, 16:57

Re: How the branchs in IArticyFlowPlayerCallbacks is ordered

Tue 5. Dec 2017, 13:34

Hi misterionkell,

its true, the plugin itself has no sorting and it usually ends up being the order of creation of the connections. But you can easily adjust to that by sorting the available branches in OnBranchesUpdated.

Code: Select all
public class BranchComparer : IComparer<Branch>
{
   int IComparer<Branch>.Compare(Branch x, Branch y)
   {
      var nodeX = x.Target as IObjectWithPosition;
      var nodeY = y.Target as IObjectWithPosition;
      return nodeX.Position.y.CompareTo(nodeY.Position.y);
   }
}

public static BranchComparer sBranchComparer = new BranchComparer();

public void OnBranchesUpdated(IList<Branch> aBranches)
{
   List<Branch> sorted = new List<Branch>(aBranches);
   sorted.Sort(sBranchComparer);
   
   // ...
}


Something like this should do the trick. Please keep in mind that this only works if your PausedOn are always nodes, if you stop on pins you have to adjust the Comparer accordingly.
I add this to our feature list to provide a builtin sorting.

Best regards

Nico
Nico Probst
Senior Software Engineer | Articy | LinkedIn
User avatar
[Articy] Nico Probst
Articy Staff
Articy Staff
 
Posts: 217
Joined: Wed 23. Nov 2011, 09:45
Location: Bochum

Re: How the branchs in IArticyFlowPlayerCallbacks is ordered

Wed 31. Jul 2019, 12:20

Has this feature been included as of now, if so, how does it look like?
User avatar
btsslawa
 
Posts: 17
Joined: Fri 21. Aug 2015, 10:14

Re: How the branchs in IArticyFlowPlayerCallbacks is ordered

Wed 31. Jul 2019, 16:22

Hi btsslawa,

no. The solution is basically what we would add anyway, and it is maybe not right for everyone. And as it is rather quick to add yourself, we just left it like it is.

Best regards

Nico
Nico Probst
Senior Software Engineer | Articy | LinkedIn
User avatar
[Articy] Nico Probst
Articy Staff
Articy Staff
 
Posts: 217
Joined: Wed 23. Nov 2011, 09:45
Location: Bochum

Return to articy:draft Unity Importer

Who is online

Users browsing this forum: No registered users and 15 guests

Who We Are
Contact Us
Social Links