English / Japanese
This package provides extension methods to write ParticleSystem
of Unity with method chains.
You can install this package using UPM (Unity Package Manager).
- Open Package Manager Window
- Click Add(+) on the status bar
- Select Add package from git URL
- Input
https://github.com/OUCC/FluentParticleSystem.git?path=Packages/FluentParticleSystem
- Click Add
=> OpenUPM Page
via command-line interface
$ openupm add org.oucc.fluent-particle-system
If you are using Assembly Deffinition, add OUCC.FluentParticleSystem
to the Assembly Definition References
public class Foo : MonoBehavior
{
public ParticleSystem particleSystem;
private void Start()
{
// Assign value with Set<ModuleName><PropertyName>
particleSystem.SetMainDuration(5.0f);
// You can change the value with the current value.
particleSystem.SetMainDuration(d => d * 2);
// You can write with method chains
particleSystem.SetMainDuration(5.0f)
.SetMainLoop(true)
.SetCollisionDampen(0.1f);
// Using Edit<ModuleName>, configure some settings of a module at a time
particleSystem
.EditMain(m =>
m.SetDuration(5.0f)
.SetLoop(l => !l))
.SetCollisionDampen(0.1f);
}
}
The extension methods provided are defined as follows
namespace OUCC.FluentParticleSystem
{
public static class MainModuleExtension
{
public static ParticleSystem EditMain(this ParticleSystem particleSystem, Action<MainModule> moduleEditor);
public static ParticleSystem SetMainCullingMode(this ParticleSystem particleSystem, ParticleSystemCullingMode cullingMode);
public static ParticleSystem SetMainCullingMode(this ParticleSystem particleSystem, Func<ParticleSystemCullingMode, ParticleSystemCullingMode> cullingModeChanger);
public static MainModule SetCullingMode(this MainModule module, ParticleSystemCullingMode cullingMode);
public static MainModule SetCullingMode(this MainModule module, Func<ParticleSystemCullingMode, ParticleSystemCullingMode> cullingModeChanger);
}
}