9092858a58
I updated everything to the latest Unity Editor. Also realized I had the wrong shaders on my hairs, those are fixed and the hairs look MUCH better!
35 lines
912 B
C#
35 lines
912 B
C#
using System.Collections.Generic;
|
|
|
|
namespace Unity.VisualScripting
|
|
{
|
|
public static class XFlowGraph
|
|
{
|
|
public static IEnumerable<IUnit> GetUnitsRecursive(this FlowGraph flowGraph, Recursion recursion)
|
|
{
|
|
Ensure.That(nameof(flowGraph)).IsNotNull(flowGraph);
|
|
|
|
if (!recursion?.TryEnter(flowGraph) ?? false)
|
|
{
|
|
yield break;
|
|
}
|
|
|
|
foreach (var unit in flowGraph.units)
|
|
{
|
|
yield return unit;
|
|
|
|
var nestedGraph = (unit as SubgraphUnit)?.nest.graph;
|
|
|
|
if (nestedGraph != null)
|
|
{
|
|
foreach (var nestedUnit in GetUnitsRecursive(nestedGraph, recursion))
|
|
{
|
|
yield return nestedUnit;
|
|
}
|
|
}
|
|
}
|
|
|
|
recursion?.Exit(flowGraph);
|
|
}
|
|
}
|
|
}
|