#EntityManager Batched Operations

1 messages · Page 1 of 1 (latest)

oak lintel
#

neverMind, I just realised it's EntityQuery

#

so maybe I still wonder if ExclusiveEntityTransaction is a thing

jovial nova
#

Eet is still a thing

#

And yeah component group is really old

oak lintel
#

thanks @jovial nova but I realised that it's not the way to go for batching operations

jovial nova
#

Man that article was from 2018

oak lintel
#

Let's recycle this useless post for a more useful question then:

jovial nova
#

I miss 5argon work

oak lintel
#

how can I set a batch of components values on a batch of components that I just added

#

let's say I did something like:

_EManager.Instantiate(dotsEntity, nativeArray);

and now I want to do a batch operation of AddComponent, how can I set different values for each component for this specific set just created?

jovial nova
#

Setting is really just iterate everything and write

oak lintel
#

yes but how I can iterate just the set of entities I just created

#

let's say I added this second batch and a first batch was already existing

#

how can I iterate just the components of this second batch

jovial nova
#

You have the native array you just passed in of those entities

oak lintel
#

yes

jovial nova
#

You can just iterate that

oak lintel
#

are you suggesting to do EntityManager.AddComponent(array[i], data)?

jovial nova
#

No

#

Do add batch operation

#

Then iterate and call set

oak lintel
#

iterate with a foreach? like Entities.ForEach?

jovial nova
#

If it's not like 100k entities just iterate in a normal loop in isystem

oak lintel
#

ok but how can I say iterate just the components of the set just created

#

I am not aware of a way to say : do not itearte all the entities in the world, just the ones just created

jovial nova
#

Just loop the native array of entities

oak lintel
#

which give me an ID to use where?

#

with a component lookup?

jovial nova
#

You never mentioned reading data

oak lintel
#

I have to write the component, not read

jovial nova
#

Then just use entitymanager setcomponent

oak lintel
#

isn't the same of doing o EntityManager.AddComponent(array[i], data) then?

jovial nova
#

No

#

Because add is a archetype change

#

If you batch all your adds in a single query call it'll be 100x faster

#

Because it can just add the component to the entire chunk

oak lintel
#

right so you say AddComponent batched and single setcomponents is better

jovial nova
#

Instead of having to move each entity individually

oak lintel
#

it's a shame I cannot do a burstified operation for this copy

#

I do have to set a large quantity of entities

jovial nova
#

Why can't you do this busted?

oak lintel
#

EntityMaanger.Setcomponent bursted?

jovial nova
#

You should be doing this all in a bursted isystem

oak lintel
#

does ISystem support that now?

jovial nova
#

Isystem supports most em operations

#

Except for managed components

oak lintel
#

that's cool, and SystemBase cannot do that?

jovial nova
#

You can't (easily) burst system base update

oak lintel
#

I meant more if now with DOTS 1.0 I can use EntityManager inside Entities.ForEach

#

trying it very quickly now

#

ok I will try ISystem

jovial nova
#

In 1.0 you should avoid efe 😅

oak lintel
#

all right trying ISystem

#

ok the DOTS examples are quite clear about it

#

thanks I see where I can get with this

#

it makes much more sense from the example for sure, looking forward to test the performance

#

last question @jovial nova are the batched operations burstified internally anyway? Regardless if I call them from burstified code or not, like the ECB playback?

#

don't tell me I cannot add am ISystem explicitly in a world

jovial nova
#

At least I don't think so

#

Maybe it's changed since I last looked in depth