Thanks for your effort and this amazing tutorial . but how can we spawn using ijobEntity with iSystem without deriving class from SystemBase.for example if i want to spawn continuously upto 2000 entities using multiple cpu cores.
@WAYNGames10 ай бұрын
You can apply the same principle. You need to create the ECB in the update loop of your system, and pass it in the IJobEntity. If you want to schedule parallel you IJobEntity, the ECB needs to be passe in as a parallel writer see docs.unity3d.com/Packages/com.unity.entities@1.0/api/Unity.Entities.EntityCommandBuffer.AsParallelWriter.html#Unity_Entities_EntityCommandBuffer_AsParallelWriter. If you have to create a bunch of entities from the same prefab, you can use the other Instantiate method from the ECB, see : docs.unity3d.com/Packages/com.unity.entities@1.0/api/Unity.Entities.EntityCommandBuffer.Instantiate.html#Unity_Entities_EntityCommandBuffer_Instantiate_Unity_Entities_Entity_Unity_Collections_NativeArray_Unity_Entities_Entity__
@anujraghav10 ай бұрын
@@WAYNGames Thanks , I am new to ecs , looking forward to your channel as you don't rush through things while explaining. Best wishes for your channel and your initiatives.
@Masterste10 ай бұрын
Thats for the calrity on the buffers : ) Really helpful,
@Cameronise15 ай бұрын
This is really great content, I am learning a lot about 1.0.16 from your videos! Keep it up! I notice on the documentation that Creating and Destroying entities are "Structural Changes" and can impact the performance when doing this at scale. Would you recommend some sort of pooling system if you know that the same prefabbed entities are going to be created -> destroyed -> created on masse? Thanks.
@WAYNGames5 ай бұрын
Hi, thanks. Pooling in ecs is much less mandatory than in mono. Creating a new entity from a prefab is really fast as it's just a meme copy except in rare occasion where you need to allocate a new chunk. So before you start doing some pulling I would just try doing the creation of the entities directly. It will be much less complicated to handle. If you go the pooling way you'll need to keep track of active and inactive entities and if they are frequently activating/deactivated I would suggest the IEnableableComponent.
@ahmedhajjami27443 ай бұрын
Hi Wayn Thanks for the hard work , i want to spawn multiple enemies with different sprite , do i need to create a prefabs for each sprite ? or there is a method to change the sprite from ecs ?
@WAYNGames3 ай бұрын
If the only difference between your enemies is the sprite you could have a list of sprites in the spawner and apply the sprite to your enemy after spawning. But if other data of the enemy are different (speed, health, d'amande dealt,...) then the one prefab per enemy would be easier.
@ahmedhajjami27443 ай бұрын
@@WAYNGames Thanks For the reply , yes the only difference is the sprite , i will use list of sprites and see how can i apply it after entity spawning