Firstborn/Library/PackageCache/com.unity.visualscripting@1.../Editor/VisualScripting.State/Flow/UnitBaseStateExtensions.cs
Schaken-Mods 9092858a58 updated to the latest editor
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!
2023-05-07 17:43:11 -05:00

37 lines
1.1 KiB
C#

using System.Collections.Generic;
using System.Linq;
namespace Unity.VisualScripting
{
[InitializeAfterPlugins]
public static class UnitBaseStateExtensions
{
static UnitBaseStateExtensions()
{
UnitBase.staticUnitsExtensions.Add(GetStaticOptions);
UnitBase.dynamicUnitsExtensions.Add(GetDynamicOptions);
UnitBase.contextualUnitsExtensions.Add(GetContextualOptions);
}
private static IEnumerable<IUnitOption> GetStaticOptions()
{
yield return StateUnit.WithStart().Option();
}
private static IEnumerable<IUnitOption> GetDynamicOptions()
{
var stateMacros = UnityAPI.Await(() => AssetUtility.GetAllAssetsOfType<StateGraphAsset>().ToArray());
foreach (var stateUnit in stateMacros.Select(statemacro => new StateUnit(statemacro)))
{
yield return stateUnit.Option();
}
}
private static IEnumerable<IUnitOption> GetContextualOptions(GraphReference reference)
{
yield break;
}
}
}