Skip to content

lightjiao/Entitas.Generic

Repository files navigation

Waht is this?

Inspired by Entitas.Generic, and I make API more simple. Work perfectly with Native Entitas VisualDebug

If you use Unity 2022.2 or more, Entitas VisualDebug may have BUG, see this: sschmid/Entitas#1067 (comment)

Code sample

  • There is a simple .Net6 sample in Entitas.Generic.Sample directory.

Use guide

  • Install Entitas before this.

  • Copy this Entitas.Generic directory into your project.

  • Copy EntitasMeta.cs file into your project if you want.

  • ❗Notice: if you want use EntityIndex, you need Add or Replace component like below:

    var entity = GameCtx.Inst.CreateEntity();
    
    var playerComp = entity.Create<Player>();
    playerComp.Id = 1,
    playerComp.Name = "Jack";
    
    entity.Replace(playerComp);
  • Get a component if it is unique ( get the first entity in group )

    var theOne = GameCtx.Inst.GetComp<Player>();
  • Flag a empty component if it is unique

    GameCtx.Inst.SetComp<Player>();
  • You need create and init Entity Index manually(Luckly it is simple and don't need change frequently)

TODO:

  • Create and init Entity Index by code generator.

About

Simple API and work perfectly with entitas visual debugging

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages