-
|
Hello everyone :) I didn't find an example in ark doc how to add a lot of components to entity. I have around 40 components. So can I add my all components to entity in one line or I need to use Map12 a few times? Could you help me with it please :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
You can either use multiple calls, or you can use the unsafe API. Althought the unsafe API is a bit slower than the generic one, this will probably be faster than multiple calls, but it is also less ergonomic. Just make sure that you don't call Creating entities using the unsafe API initializes them with zero-value components, so you still need to assign the actual values. |
Beta Was this translation helpful? Give feedback.
You can either use multiple calls, or you can use the unsafe API. Althought the unsafe API is a bit slower than the generic one, this will probably be faster than multiple calls, but it is also less ergonomic. Just make sure that you don't call
ecs.ComponentIDevery time, but only once and re-use the IDs.Creating entities using the unsafe API initializes them with zero-value components, so you still need to assign the actual values.