protected override void OnCreate() { endSimulationECBSystem = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>(); var ecb = new EntityCommandBuffer(Allocator.Temp); // Initialize our player data player = ecb.CreateEntity(); resources = new Dictionary <ResourceTypes, Text>(); // UI textfield mapping DynamicBuffer <PlayerResourceData> playerResources = ecb.AddBuffer <PlayerResourceData>(player); ecb.AddComponent <PlayerTag>(player); #region Initialize player resources (buffer) AddStartResources(playerResources, new ResourceTypes[] { ResourceTypes.Gold, ResourceTypes.Wood, ResourceTypes.Iron, ResourceTypes.Crystal }); #endregion #if UNITY_EDITOR EntityManager.SetName(player, "Player Resource Data"); #endif ecb.Playback(EntityManager); ecb.Dispose(); }
private void LoadPatternPrefabs() { foreach (var patternAsset in patternAssets) { var patternEntity = patternAsset.Convert(entityManager); entityManager.SetName(patternEntity, patternAsset.name); } }