Order of actions in "On start of layout" is not working

0 favourites
  • 6 posts
From the Asset Store
Plugin Transition Layout C3. Layout opening and closing animation for C3. Quickly set up transitions between lay
  • I have a function that creates 80 objects using loop "for each". Then I call this function in "On start of layout" event.

    Next actions in this event do some stuff with created objects (makes them visible, creates another objects over them etc). But I found those next actions doesn't work like objects don't exist yet.

    If I understand it right event starts creation loop action and start following actions without waiting for loop to be finished. Is it true?

    Tagged:

  • Most important thing for me is to know how to set up loops in "On start of layout event". Should I control when loops finished and only then start following actions or not?

  • Objects do not finish the creation process until the top level event that creates them finishes. So, You can not call a function in that event - as far as the function is concerned, the objects do not exist yet.

    the easiest solution may be to add another "On start of layout" event immediately after the current one, and call the function from there.

  • Objects do not finish the creation process until the top level event that creates them finishes. So, You can not call a function in that event - as far as the function is concerned, the objects do not exist yet.

    the easiest solution may be to add another "On start of layout" event immediately after the current one, and call the function from there.

    So problem happens because of using function? Event starts function but doesn't wait finishing actions inside this function, right?

  • it is not really the function, it is the fact that the objects created do not become "pickable" until the next top level event. You could move the actions from the function into the "On start of layout" event and they would still not work.

    another way around this is to add a Wait 0 Seconds just before the function call (as long as the fuction call is not inside a loop), because that defers actions after the wait until the end of the current tick... but people usually run into problems implementing that properly, so it would be better to add the extra "On start of layout" event.

    if the function call is inside a loop, you can pass the UID of the object to the function and pick the new object by its UID.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • it is not really the function, it is the fact that the objects created do not become "pickable" until the next top level event. You could move the actions from the function into the "On start of layout" event and they would still not work.

    This explains my problem. Does it happen only with creation of an objects?

    I've added signals for finishing creation and added "Wait for signal" between actions. Now it works.

    Also I've tried your merhod with another "On start of layout event" and it works too.

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