# Changing the current state of an entity in the middle of an update step or wait for the end?

Let's say that I use a behaviour component that holds a function call to be called every update step assigned to an entity. Inside that function call I'm changing the active state for the entity to activated or deactivated, something like this:

void fun_update() {
this_entity->set_active(true);
if (this_entity->is_active()) { // This should return true or false?
....
}
}


What would be more correct? To change the state for the current update iteration or wait for the end of the current update step to update the state of the entities?

I know that, unity3d for example, changes the current state, but when coding my own engine I find easier to update it at the end.

For me, set_active() having an immediate effect seems more usable because it does exactly what it says - the entity is active, and the next line of code can assume that.
If you're very concerned about making the wrong choice and getting locked into an inconvenient structure, you could add both options - maybe set_active() and set_active_delayed() - and use the one that best fits each case.