[Solved] How to get EntityID of a slice spawned?

Hi @LS1 :slightly_smiling_face:

I found a bad issue 6-9 months ago , I forgot to report this earlier , this is related to spawn slices, NOW , I have a question :relaxed: I see a return value of slice type in Spawn Node.

How to get EntityID of a slice spawned :question: :face_with_monocle: :thinking:

image

@_AhmadKarami

We have these two methods, the first one you can get the entities in a slice by passing in the SliceInstantiationTicket
image(45)

The second one is as an even, when the entities spawn, you can use this node to get the array of EntityIds:

image(46)

1 Like

GREAT @LS1 , Thank you , So Why you/your team do not delete this nodes like bottom ,I think these nodes confuse users? No? Or am I wrong? Why do these nodes exist? Do they have applications? :point_down: :face_with_monocle: :thinking:
image

@LS1 I’m sure , you & your team , have a plan for clean up Unused and obsolete nodes Or am I wrong?

The node in your screenshot is no longer part of the Spawner component, the spawn function in 1.25 should be similar to this one: (note: my screenshot is from an in-development build, so it’s slightly different)

image

Is this an image from an old graph?

I mean nodes of entity group in node palette in 1.25
Unused and obsolete nodes in 1.25 ? :face_with_monocle: :thinking:

Thank you , you solved my question in this topic :pray: :rose:

@LS1 But I think some nodes :point_up_2: are Unused and obsolete nodes in 1.25 ?Or am I wrong?

@LS1 We see two type of Active nodes variable :thinking: :face_with_monocle:
01- a type active node does not support EntityID variable
02- another type active node does support EntityID variable

Unused and obsolete nodes in 1.25 ?Or am I wrong?

I found this issue in 2018 or 2019 , Another example, for destroy nodes and other nodes :slightly_smiling_face:

Is It possible change out param of Slice to EntityID?
Or make a node similar to what I posted here?
Isn’t this faster?
Please see this shot :blush: :point_down:
image

EntityID and Entity are not the same type.

The nodes you asked about were written with the idea of allowing users to create Entities and Components at runtime. That set of nodes were written a very long time and could be improved to work with EntityID instead of using Entity directly. For the moment, I wouldn’t recommend using this functionality.

I will write a task to track this, thanks!

1 Like

Unfortunately it’s not as simple, a slice is a collection of entities, this is why the other nodes I mentioned return an Array. Also, there is some indeterminate amount of time between the Spawn call and the actual spawning of all of the slice’s entities. This is why I recommend using the event node (OnEntitiesSpawned) as it will guarantee that all of the slice’s entities are created and activated.

I will add a task to evaluate what improvements we could implement to make this easier.

1 Like

@LS1 You are doing a great job, I understand & I know , develop a game engine with c++/lua is very very hard & consuming time , Thank you so much For your honest answer and your humility :rose: :pray: :slightly_smiling_face:

Yes, it’s a lot of work, but also a lot of fun, I’m very happy you’re using it and getting such nice results with it. Everything you’re doing is helping us make Lumberyard better for everyone. Thanks!

1 Like

@LS1
I’m also very happy to work with you, the great programmer.

I finding bugs, problems , suggest ideas, and create video tutorials for Lumberyard , 1.25 is really great but please go here and take a look at these my review about script canvas , if you have a bit time , Thank you again :rose: :blush: