This function gets the layer ID that the given element is on.
You supply the unique element ID value (for example, as returned by the function that created the element or from The Room Editor) and the function will return the unique ID of the layer that the element is found on. If the element ID given is not a valid one, then the function will return -1.
layer_get_element_layer(element_id)
Argument | Type | Description |
---|---|---|
element_id | Layer Element ID | The unique ID value of the element to get the layer of |
Layer or -1 (if the element is invalid)
element = layer_get_element_layer(asset_1);
The above code gets the layer ID for the element with the ID stored in the variable asset_1 and stores it in a variable.