I have some convention of layers naming like: "level_0", "level_1", "level_2". And there is logic shared between events sheets.
I need to implement a function that does "go to layer by dynamic name". But is important to call it only is layer with dynamic name exists.
Is there API method for that?
Did you mean layer or layout?
The only way I know how to check if a layout with a certain name exist, is to try switching to it, and then check after a delay if the current layout has changed. Here is a screenshot from one of my games:
Sorry, I meant "layout".
So there is no native methods to do this without hacks?
Maybe there is another API to fetch a list of all layouts and then compare some variable with it?
Turns out there is -
dropbox.com/s/zvhexq7v22jd9vj/layout_check.c3p
Credit goes to Eren.
Any chance you can update your topic title to layout rather than layer so this is more useful?
I just tried a search for "How to check if layers exist", and was brought here :(
AnD4D
Here is one possible way if all your layers are visible.
global text name="fish" is layer name visible -- layer exists else -- layer doesn't exist
Develop games in your browser. Powerful, performant & highly capable.
Any chance you can update your topic title to layout rather than layer so this is more useful? I just tried a search for "How to check if layers exist", and was brought here :(
With a slight tweak from the previous layout check example, now a layer check example
Compare Two Values: layerIndex("name")>=0
:)