layer_get_element_layer

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.

 

Syntax:

layer_get_element_layer(element_id)

ArgumentTypeDescription
element_idLayer Element IDThe unique ID value of the element to get the layer of

 

Returns:

Layer or -1 (if the element is invalid)

 

Example:

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.