Home

Awesome

Morpeh Helpers

Here you'll find some helper utils for Morpeh ECS framework.
THIS IS NOT PART OF MORPEH ECS, JUST FEW HELPERS BY ME, USE IT AT YOUR OWN RISK

How to install

The minimal checked Unity Version is 2020.3.* LTS
Also, make sure you've already installed Morpeh, either you'll get compiler errors.

Open Package Manager and "Add package from git url..." using next string:

Content

Extensions for Entities, Stashes and Filters

Simple update systems

They're abstract classes based on UpdateSystem, FixedUpdateSystem, or LateUpdateSystem. They'll let you reduce boilerplate in your code for simple systems, where you query through one filter with one/two/three components. No need to manually define the filter and iterate through that, just write your logic like you're processing one entity.

They leave you only one method to implement: Process(entity, ref c1(, ref c2)(, ref c3), deltaTime). Process() also will be called during OnAwake() of system, you can use protected field inAwake to branch your logic for this case.

Available classes:

Example:

    public sealed class HealingSystem : SimpleUpdateSystem<HealthComponent> {
        public float healRate = 1f;
    
        protected override void Process(IEntity entity, ref HealthComponent health, float deltaTime) {
            health.amount += healRate * deltaTime;
        }
    }

One-Frame Components

aka Auto-clean systems

That util will let you register a type of component to clean up all existing components during LateUpdate(based on ICleanupSystem in Morpeh). So you'll be able to write World.RegisterOneFrame<T>() once and fire components without the need to clean up after you.
How to use that: Just call extension-method World.RegisterOneFrame<T>() in OnAwake() of your system to system's World property.

<details> <summary>How to migrate from previous SO-based OneFrames</summary> </details>

Templates for Rider

If you're using JetBrains Rider, I also can offer Morpeh Templates for you.\

It contains:

How to import templates to your project:

Templates for Unity

You can install it like ScriptTemplates in Morpeh itself. (In Unity inspector: Packages -> Morpeh Helpers -> Packages -> ScriptTemplates.unitypackage).

It contains templates for each Simple update system with various number of components.