public void OnEnable() { if (_mapGeneratorSystem != null) { return; } DefaultWorldInitialization.DefaultLazyEditModeInitialize();//boots the ECS EditorWorld _mapGeneratorSystem = World.DefaultGameObjectInjectionWorld.GetOrCreateSystem <MapGeneratorSystem>(); //EditorApplication.update += () => _mapGeneratorSystem.Update();//makes the system tick properly, not every 2 seconds ! }
public void GenerateMap2() { _mapGeneratorSystem = World.DefaultGameObjectInjectionWorld.GetOrCreateSystem <MapGeneratorSystem>(); World world = World.DefaultGameObjectInjectionWorld; blobAsset = new BlobAssetStore(); var conversionSetting = new GameObjectConversionSettings(world, GameObjectConversionUtility.ConversionFlags.AssignName, blobAsset); Entity mapEntity = GameObjectConversionUtility.ConvertGameObjectHierarchy(mapPrefab, conversionSetting); _mapGeneratorSystem.mapPrefab = mapPrefab; _mapGeneratorSystem.mapEntity = mapEntity; _mapGeneratorSystem.mapGenSettings = mapSettings; _mapGeneratorSystem.debugMaterial = debugMaterial; _mapGeneratorSystem.GenerateMapMatchingSquares(); blobAsset.Dispose(); }