action runtime.getAllLayouts();

0 favourites
  • 2 posts
From the Asset Store
Alot of High Quality Items sound effects for your game!
  • Hi,

    Is there a system action that does the same thing as runtime.getAllLayouts();

    I just want an array with all the layout-names.

    At this moment I do it this way, and it works, but I am just wondering if this can be done without using scripting:

    let larray = runtime.getAllLayouts();

    let a = runtime.objects.Array.getFirstInstance();

    a.setSize(larray.length,1,1,);

    for (let i = 0; i < larray.length; i++){

    a.setAt(larray.name,i-1);

    }

    Thanks!

    (I posted this topic in 'How do I...? and not in scripting because I have a question about doing something without scripting. )

    Wim

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't think there is.

    You can probably do it like so with events:

    1. Set global var "gettingLayouts" true

    2. Access the current layout name with the LayoutName expression and write it into the array

    3. Use the "go to next layout" action

    4. repeat until you run out of layouts, set "gettingLayouts" false, then go back to the first layout

    Quite convoluted and ugly, I'd not do it this way. Simpler would be to not dynamically create that array I suppose, but that means you have to update it by hand every time you add/remove a layout.

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