How do I get Layer Name as a string from its index number?

0 favourites
  • 4 posts
From the Asset Store
This collection of music is the beautiful performance of rather small strings ensemble (8 first violins, 6 second violin
  • There doesn't seem so be a command for this. Is it only possible to handle things the other way around (getting layer index from its name).

    I have a system that has all the UI menu screens as different layers and a loop that goes through each layer setting it's scale, visibility etc. I'm trying to automate it to deactivate/activate groups as well since each layer has its own group.

  • I don't think it's possible. When I need to process many layers in a loop, I name them like L1, L2, L3 or UI1, UI2, UI3 etc.

    And then I can do, for example:

    For "n" from 1 to 10
    Set Layer "UI"&loopindex invisible
    
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yeah looping the layers is not a problem, that part is working well.

    But If I could have gotten the layer name as a string I could have automatically disabled the event group connected to that layer since I use similar naming technique with groups as well.

    I have named the layers "UI_Menu_" & group name. This enables me to activate the selected group with a string variable set as the event group name, but disabling the layer groups is more tricky. I guess I just need to use 2 strings, one for active group name and one for the group last activated before the current group was activated. That isn't so bad, but getting the layer names would have simplified it.

  • Oddly, there is an expression to get layer index from name - LayerIndex("name"), but no expression to get layer name from index. You can post a suggestion to add it:

    construct3.ideas.aha.io/ideas

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)