protected override JobHandle OnUpdate(JobHandle inputDeps)
 {
     //handle the gameobject display and changes
     if (EntityDebug != null)
     {
         if (DebugComponent != null)
         {
             if (DebugComponent.active)
             {
                 if (desiredEntity.Equals(new Entity {
                 }) || EntityManager.GetName(desiredEntity) != DebugComponent.EntityName)
                 {
                     if (DebugComponent.EntityName == "")
                     {
                         Debug.LogWarning("Cannot display or change entity with a blank Entity name");
                     }
                     else
                     {
                         if (CoreDataQuery.CalculateEntityCount() > 0)
                         {
                             string[] a = DebugComponent.EntityName.Split(':');
                             if (!CoreFunctionsClass.FindEntity(EntityManager, ref desiredEntity, a[0], a.Length > 1 ? a[1] : ""))
                             {
                                 Debug.LogWarning("Failed to find Entity that matches \"" + DebugComponent.EntityName + "\"");
                             }
                         }
                         else
                         {
                             Debug.LogError("Cannot use LiveEntityDebugging with no Entity with a CoreData Component");
                         }
                     }
                 }
                 else
                 {
                     DebugComponent.Display.Update(EntityManager, desiredEntity);
                 }
                 //Handle Global Settings
                 if (DebugComponent.GlobalSettings.applyChange)
                 {
                     DebugComponent.GlobalSettings.ApplyChanges();
                     DebugComponent.GlobalSettings.Update();
                     DebugComponent.GlobalSettings.applyChange = false;
                     DebugComponent.GlobalSettings.editMode    = false;
                 }
                 else if (!DebugComponent.GlobalSettings.IsUpdated() && !DebugComponent.GlobalSettings.editMode)
                 {
                     DebugComponent.GlobalSettings.Update();
                 }
             }
         }
     }
     return(inputDeps);
 }
        public static void GenerateEnviroment(string region, string enviroment, EntityManager entityManager,
                                              float3 bounds, float3 position, quaternion rotation, float3 scale, float bevelRadius = 0)
        {
            EntityArchetype defaultArchtype = entityManager.CreateArchetype(
                typeof(Translation),
                typeof(Rotation),
                typeof(Scale),
                typeof(LocalToWorld),
                //		typeof(PhysicsCollider),
                typeof(AudioSharedData),
                typeof(AudioData),
                typeof(CoreData)
                );
            Entity      entity = entityManager.CreateEntity(defaultArchtype);
            Translation trans  = new Translation {
                Value = position
            };

            entityManager.SetComponentData(entity, trans);
            entityManager.SetComponentData(entity, new Scale {
                Value = scale.x
            });
            CoreData _cd = new CoreData(new ByteString30(enviroment), new ByteString30(region), bounds, new float3(1f, 1f, 1f));

            entityManager.SetComponentData(entity, _cd);

            /*	entityManager.SetComponentData(entity, new PhysicsCollider
             * {
             *      Value = Unity.Physics.BoxCollider.Create(new BoxGeometry
             *      {
             *              Center = position+(bounds/2),
             *              Size = bounds,
             *              Orientation = rotation,
             *              BevelRadius = bevelRadius
             *      })
             * });*/
            entityManager.SetSharedComponentData(entity, GetEnviromentSoundInfo(region, "Forest"));
            switch (enviroment)
            {
            case "Forest":
                //populate forest entities
                //we gonna need some trees, and bushes
                GameObject ForestTreeGO = Resources.Load("Enviroment/Kanto/Forest/Landscapes/Tree/Tree") as GameObject;
                ForestTreeGO = GameObject.Instantiate(ForestTreeGO);
                if (ForestTreeGO != null)
                {
                    //create the exclude list
                    NativeArray <CoreData> excludes = new NativeArray <CoreData>(1, Allocator.TempJob);
                    excludes[0] = _cd;
                    //get all the entities position/size within an area
                    //	NativeArray<Bounds> cubes = CoreFunctionsClass.GetEntitiesWIthinArea(entityManager, position, bounds, excludes, true);

                    //	Debug.Log("bounds = "+ ForestTreeGO.GetComponent<MeshFilter>().mesh.bounds.size);
                    //	NativeArray<Entity> trees = new NativeArray<Entity>(30, Allocator.Temp);
                    //	entityManager.CreateEntity(GetEnviromentArchtype(entityManager, "Tree"), trees);

                    //calculate size
                    //	float3 size = ForestTreeGO.GetComponent<MeshFilter>().mesh.bounds.size;


                    //set the values
                    //	SetEnviromentEntityData(entityManager, ForestTreeGO, trees,cubes,true, region, "Tree",
                    //		size, position, bounds);
                    //	trees.Dispose();



                    excludes.Dispose();


                    Entity e = new Entity {
                    };
                    bool a   = CoreFunctionsClass.FindEntity(entityManager, ref e, "Tree", "Kanto/Landscapes/Tree");
                    if (a)
                    {
                        NativeArray <Entity> generatedEntities = CoreFunctionsClass.SpawnEntitiesWithinBounds(entityManager, e, new Bounds(trans.Value, _cd.size), 30, excludes, new float[0, 0], true);
                        entityManager.AddComponentData(e, new DestroyMe {
                        });

                        generatedEntities.Dispose();
                    }
                    else
                    {
                        Debug.LogError("Failed to find Tree entity");
                    }
                }
                else
                {
                    Debug.LogError("Failed to successfully load ForestTree");
                }
                GameObject.Destroy(ForestTreeGO);


                break;

            default: Debug.LogError("cannot create enviroment with name \"" + enviroment + "\""); break;
            }
        }