readme.md
May 13, 2025 ยท View on GitHub
Myriad.Unity.ECS
Integration for Myriad ECS into Unity.
Installation
Install in Unity package manager, git url: git@github.com:martindevans/Myriad.ECS.Unity.git?path=/Packages/me.martindevans.myriad-unity-integration
Scene Driven Usage
- Create a
WorldHost<TData>in the scene (most likely aGameTimeWorldHost) - Create a new
MonoBehaviour, extendingWorldSystemGroup<TData> - When the system group is enabled/disabled in the scene, it will be added/removed to the Myriad system list
Advanced Usage
- Create a new MonoBehaviour, extending
BaseSimulationHost. This runs your Myriad simulation. - Add
MyriadEntityBindingSystem<TData>somewhere into your system schedule. - Create a new simulation host editor:
[CustomEditor(typeof(SimulationHost))]
public class SimulationHostEditor
: BaseSimulationHostEditor<SimulationHost, TData>
{
}
- When you create an
Entitywhich you want to bind to a GameObject, instantiate the GameObject with aMyriadEntitybehaviour attached. Attach this behaviour to theEntity. - For every system you want to inspect, create a new system editor:
[MyriadSystemEditor(typeof(YourSystem))]
public class YourSystemEditor
: IMyriadSystemEditor
{
public void Draw<T>(ISystem<T> sys)
{
var system = (sys as YourSystem)!;
EditorGUILayout.LabelField($"Myriad Is Cool");
}
}
For every component you want to inspect, create a new component editor:
[MyriadComponentEditor(typeof(YourComponent))]
public class PagedRailEditor
: IMyriadComponentEditor
{
public void Draw(MyriadEntity entity)
{
var rail = entity.GetMyriadComponent<YourComponent>();
EditorGUILayout.LabelField("Myriad Is Great");
}
}