Open iampremo opened 1 year ago
I really like this feature request and agree that this would be a clear benefit. The activate / deactivate feature is a wonderful feature for being able to optimize performance and adding flexibility to object behavior, for instance, to create objects with delayed effects (deactivated for some delay and then activated).
Customer's description:
_Sometimes (a lot) during game development especially if they require performance management (export for mobiles, consoles...) developers end up needing to disable instances that will mess up some functions like "instance_exists", "instance_number" and "instancefind ". My request is allowing these functions to query also deactivated instances.
_instance_exists(obj, includedeactivated); _instance_number(obj, includedeactivated); _instance_find(obj, index, includedeactivated);
where "deactivated" would be a boolean that would allow for the inclusion of deactivated instances. This would probably be better packed with a new function called.
_instance_isactive(id);
_Allowing to check if an instance (returned by) instance_find(obj, index, include_deactivated), is active or not. Some notes and ideas, regarding the "instancefind" method... the deactivated instances could have their indexes towards the end, so instance references (under the wood) can be kept in different collections.
It would be great if both functions below allowed to provide an optional obj parameter
_instance_activateregion(left, top, width, height, inside, obj=all) _instance_deactivateregion(left, top, width, height, inside, notme, obj=all)
this would allow for activate/deactivate all instances of a given object within the region. It could default to all to maintain backwards compatibility.
Customer's benefit:
Of course, there are ways for dealing with this, ie.: creating global lists/maps to store instances, manually checking those lists to retrieve instances that are disabled. But if the problem we are trying to tackle when deactivating instances is the performance on less performant platforms it is counterproductive to have to implement a system using GML that will always be a slow implementation.