UI Object Changes Layer Unprompted

0 favourites
  • 6 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I've got UI elements set to global. They're created on level one, and persist to the next level. They are on the correct layer until level five, then inexplicably get moved to another layer. The UI layer the objects are on exists on all levels, and no events change the layers the objects should be rendered to.

    For now, I'm forced to add an event that checks if they're on the right layer at the start of the layout, and if not, move them. But this really shouldn't be happening in the first place.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I believe when you switch layouts, global objects are transferred to a layer with the same layer number, not with the same name.

    I think in your case it may be better to make the layer "UI" global. And disable global attribute for UI objects.

  • The runtime will also move objects to a different layer if the layout doesn't have the same number of layers. For example if an object is on layer 5 and you move to a layer with just three layers, all the objects on the higher layers will be moved down to the top layer.

  • I believe when you switch layouts, global objects are transferred to a layer with the same layer number, not with the same name.

    I think in your case it may be better to make the layer "UI" global. And disable global attribute for UI objects.

    This seems to be the behavior I'm looking for, Thanks! Is there a way to tell it not to override this layer on certain layouts?

  • The runtime will also move objects to a different layer if the layout doesn't have the same number of layers. For example if an object is on layer 5 and you move to a layer with just three layers, all the objects on the higher layers will be moved down to the top layer.

    Does that mean I need to be making every layout with the same number of layers, even if I don't need them on every layout?

  • Is there a way to tell it not to override this layer on certain layouts?

    No there isn't. You can just use a different global layer.

    Does that mean I need to be making every layout with the same number of layers, even if I don't need them on every layout?

    This is not a good idea. If you want the global object to appear on a specific layer, the easiest solution is to create an event which will move it to that layer on start of any layout.

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