When I use any of the instance_activate_...() functions, then the instance is not activated immediately, but I can use the instance in the next step. Since there is still a way to access it's variables, the instance is not completely destroyed from memory. I wondered if there would still be a way to run code from it. I'm trying to get the instance destroyed before the next step occurs, because other code will run first. For example an object that loops through all currently activated instances and does something with the information.Activate it then destroy it.
Ah, I read somewhere that you can't use instances the same step you activate them.What sort of code would you need to execute, anyway?
Also, instances are accessible right after an instance_activate() call. I've used this behavior in some of my projects. Under the hood, active and inactive instances are just two lists, and the functions move them from one list to the other. with loops and the event-execution loop only care about the active list. Using the dot notation bypasses the list altogether, which is why you can read and write variables using the dot notation even on inactive instances. I can't tell if it's a bug or a feature.
The Cleanup event is run when an instance is permanently removed, no matter how, so if you worry about data structures or surfaces (or other potential memory-leak sources) you could use that and then don't worry how the instance is destroyed - things like leaving the room also triggers it.
I think that text meant that those instances won't have a step event that step if you activate them in a step event... I've never really had any concerns with that since I run my activation logic in an alarm to reduce overhead, but I guess it could trip things up.Ah, I read somewhere that you can't use instances the same step you activate them.