Pipeliner helps you execute sequences, such as initializing social services, loading savegames, loading scenes, level generation and more using custom made Steps.
- Clone or download repository.
- Copy Pipeliner folder from Plugins folder to your project.
- Take a look at the included Demos.
- Done!
Developed in Unity 2020.3.23f1, but I don't see why it wouldn't work in any Unity version.
- Create a new script for your custom Step (named FooStep, for example). Step classes are used to execute your logic. Your class should look something like this:
public struct FooStepParameters : IStepParameters
{
public float Value;
}
public class FooStep : AbstractStep
{
public FooStep(FooStepParameters parameters) : base(parameters)
{
}
public override IEnumerator Run(Action<IStepResult> result)
{
yield return null;
var parameters = (FooStepParameters)Parameters;
// Your custom logic here
Progress = 1f;
result?.Invoke(new IStepResult.Success());
}
}
- Create new scripts for your Step Factories (named FooStepBehaviour and FooStepObject, for example). Factories are used to create a new instance of your step in MonoBehaviour and Scriptable Object pipelines. Your factory classes should look something like this:
public class FooStepBehaviour : StepFactoryBehaviour
{
public override IStep[] Create()
{
return new IStep[] {new FooStep(new FooStepParameters{Value = 0f})};
}
}
[CreateAssetMenu(fileName = "Foo Step", menuName = "Foo/Step")]
public class FooStepObject : StepFactoryObject
{
public override IStep[] Create()
{
return new IStep[] {new FooStep(new FooStepParameters{Value = 0f})};
}
}
- Add a Pipeline Runner and Pipeline GameObjects to your scene (found in GameObject/Pipeliner) and drag Pipeline GameObject to the Pipeline field in Runner GameObject.
- Add your custom FooStepBehaviour script to the Pipeline GameObject.
- Press play!
A basic example that prints Debug.Log
s using a MonoBehaviour Pipeline.
A demo that uses Scriptable Object Pipelines and Steps.
A demo that shows how to use Pipeliner to initialize services and save data using custom Steps.
A demo that shows how to create and run a Pipeline and Steps in script to load menus and levels.