Integration for Myriad ECS into Unity.
Install in Unity package manager, git url: [email protected]:martindevans/Myriad.ECS.Unity.git?path=/Packages/me.martindevans.myriad-unity-integration
- 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
- 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
Entity
which you want to bind to a GameObject, instantiate the GameObject with aMyriadEntity
behaviour 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");
}
}