With this function you can deactivate all instances assigned to a specific layer. You need to supply the layer ID, which can either be the name of the layer as written in the code editor (as a string) or the actual layer ID value as returned by the layer_create, and note that you can only deactivate instance layers with this function. Note that if you have deactivated a layer that has instances of objects flagged as Persistent, then you will need to reactivate the layer again with the function instance_activate_layer before changing room, otherwise any persistent instances on the layer will not be carried over and will be discarded. Note too that deactivation is not instantaneous, and an instance that has been deactivated in this way will not be considered to be inactive until the end of the event in which the function was called.NOTE:If you deactivate an instance on room start (ie:from the room creation code, or from an instance create event of an instance within the room) all instances that are placed within the room from the room editor will still run their create event before being deactivated.WARNING:Deactivating instances that have physics enabled will NOT stop their fixtures from interacting within the physics simulation. For that you should set their phy_active variable to true or false as you activate/deactivate the instances.
|layer||The layer ID string (or value) to be used|
var _vx = camera_get_view_x(view_camera);
var _vy = camera_get_view_y(view_camera);
var _vw = camera_get_view_width(view_camera);
var _vh = camera_get_view_height(view_camera);
instance_activate_region(_vx - 64, _vy - 64, _vw + 128, _vh + 128, false);
The above code deactivates all instances assigned to the layer "Enemy_Layer" and then activates a region within the room.