void CreateEntity(GameObject obj, World world, Entity sectionEntity, GUID sceneGuid) { Debug.Log("Added entity to world: " + world.Name); var manager = world.EntityManager; var entity = manager.CreateEntity(); manager.SetName(entity, "MyEntity"); // Link entity to GO manager.AddComponentData(entity, GameObjectConversionUtility.GetEntityGuid(obj, 0)); // Copy GO transform manager.AddComponentData(entity, new LocalToWorld { Value = obj.transform.localToWorldMatrix }); manager.AddComponentData(entity, new Translation { Value = obj.transform.localPosition }); manager.AddComponentData(entity, new Rotation { Value = obj.transform.localRotation }); // Set the SceneTag and SceneSection on the entity so it's in the sub-scene manager.AddSharedComponentData(entity, new SceneTag { SceneEntity = sectionEntity }); manager.AddSharedComponentData(entity, new SceneSection { SceneGUID = sceneGuid }); }