Search Unity

How do I Hybrid with UTF?

Discussion in 'Entity Component System' started by Ryuuguu, Jan 26, 2020.

  1. Ryuuguu

    Ryuuguu

    Joined:
    Apr 14, 2007
    Posts:
    391
    I can test pure ECS with UTF no problem. A minimal example would be to test that a GameObject with Monobehaviour that adds two IComponentData structs does that. Later tests could test the systems etc. run properly. So if I had this monobehaviour.

    Code (CSharp):
    1. public class TxAutotrophBehaviour : MonoBehaviour, IConvertGameObjectToEntity {
    2.        
    3.         void IConvertGameObjectToEntity.Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    4.         {
    5.             if (enabled) {
    6.                 dstManager.AddComponentData(entity, new  TxAutotroph());
    7.                 dstManager.AddComponentData(entity, new  EnergyStore());
    8.             }
    9.  
    10.         }
    11.     }
    How could I make something that runs in Test Runner and checks that I now have an entity with those ComponentData structs on it and check their Values? Ideally, I would like to do this both in straight code and separately with a test scene. Are there any examples out there that do something similar?