public static GameObject Create(EcsWorld world, string name = null)
        {
            if (world == null)
            {
                throw new ArgumentNullException(nameof(world));
            }
            var go = new GameObject(name != null ? $"[ECS-WORLD {name}]" : "[ECS-WORLD]");

            DontDestroyOnLoad(go);
            go.hideFlags = HideFlags.NotEditable;
            var observer = go.AddComponent <EcsWorldObserver> ();

            observer._world = world;
            var worldTr = observer.transform;

            // entities root.
            observer._entitiesRoot = new GameObject("Entities").transform;
            observer._entitiesRoot.gameObject.hideFlags = HideFlags.NotEditable;
            observer._entitiesRoot.SetParent(worldTr, false);
            // filters root.
            observer._filtersRoot = new GameObject("Filters").transform;
            observer._filtersRoot.gameObject.hideFlags = HideFlags.NotEditable;
            observer._filtersRoot.SetParent(worldTr, false);
            // subscription to events.
            world.AddDebugListener(observer);
            return(go);
        }
Exemple #2
0
 public RemoteDebugClient(EcsWorld world, int port = 1111, string host = "localhost")
 {
     _world = world;
     _world.AddDebugListener(this);
     _url = new Uri($"ws://{host}:{port}");
     Connect();
 }
        public static GameObject Create(EcsWorld world, string name = null)
        {
            if (world == null)
            {
                throw new ArgumentNullException("world");
            }
            var go = new GameObject(name != null ? string.Format("[ECS-WORLD {0}]", name) : "[ECS-WORLD]");

            DontDestroyOnLoad(go);
            go.hideFlags = HideFlags.NotEditable;
            var observer = go.AddComponent <EcsWorldObserver> ();

            observer._world = world;
            world.AddDebugListener(observer);
            return(go);
        }