Skip to content
Discussion options

You must be logged in to vote

I see. Well, this is risky at first glance and most likely your problem too:

InstantiateScript = [this]() 
        {

You're capturing this, the address of the component assigned to the entity, is it?
In this case, keep in mind that components are moved within a pool to optimize performance iterations. Unless you tell EnTT not to do that ofc, since everything is configurable here. 🙂
If you want stable pointers for your component type, add the following to your Script class:

static constexpr auto in_place_delete = true;

In this case, this is never invalidated until you destroy the component itself.

Another option is to make the instantiation function static and pass the script to it as an a…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@skypjack
Comment options

Answer selected by MokaHiko
@MokaHiko
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
discussion it sounds interesting, let's discuss it
2 participants