1. Hello Guest! It's with a heavy heart that we must announce the removal of the Legacy GMC Archive. If you wish to save anything from it, now's the time! Please see this topic for more information.
    Dismiss Notice

GMS 2 Instance Order In Layers is Glitched

Discussion in 'Programming' started by Trasoside, Dec 22, 2018.

  1. Trasoside

    Trasoside Member

    Joined:
    Jun 25, 2016
    Posts:
    30
    Since updating to runtime v2.2.1.287 I've noticed somthing strange. (it also happens in 291..)
    when deactivating/activating instances, they go back to the layer they were depending on their Creation Order! instead of their order inside the layer, and I've found no way to control it.
    example:
    before deactivating:
    upload_2018-12-22_14-51-16.png
    after deactivating:
    upload_2018-12-22_14-51-28.png
    after activating:
    upload_2018-12-22_14-51-39.png

    the same happens when using layer_add_instance(layer, inst),
    but what i found out was, it only happens when doing it in the same frame.
    if you do it 1 instance per frame it's fine (the instance moves to the back of the layer).

    I've attached some examples here feel free to mess with them:
    https://www.dropbox.com/s/ugi7uk0c59p7rmp/testlayerdepths.rar?dl=0

    can anyone relate?
     

    Attached Files:

  2. The-any-Key

    The-any-Key Member

    Joined:
    Feb 2, 2017
    Posts:
    1,522
    If you want different draw orders. You need to use different layers. Or use an object that draw them in the order you want. Instances on the same layer can change execution order anytime. This is also true in 1.4. For most time it is the creation order, so people did not notice. But don't count on that.
     
  3. McKayB

    McKayB Member

    Joined:
    Sep 18, 2018
    Posts:
    5
    Also, if you set the objects' depth to force their draw order, make sure the difference in depth is at least 1. Found that out the hard way when struggling with this same issue.
     
  4. Trasoside

    Trasoside Member

    Joined:
    Jun 25, 2016
    Posts:
    30
    The point is we've built a whole game with tons of level relying on the order inside the layer and after updating the runtime bugs began to show up.. so yeah we could go through all the depth bugs but I believe it is necessary to suply one of the following:

    - keep the instances in the order they were before deactivating them, I mean, in the begining of the room it was fine, why ruin it?

    - or just to suply somthing like instance_bring_to_front(inst)

    - or order the instances by the activate order and not by instance creation order

    I want them to be in the same layer because otherwise I'd have to create a layer for every instance and it sucks..
     
  5. The-any-Key

    The-any-Key Member

    Joined:
    Feb 2, 2017
    Posts:
    1,522
    It was not ruined. The feature you seek was never there in the first place.

    From GMS2: https://docs2.yoyogames.com/index.html?page=source/_build/index.html
    From GMS1.4: https://docs.yoyogames.com/source/dadiospice/000_using gamemaker/events/index.html
     
    Last edited: Dec 23, 2018
  6. Trasoside

    Trasoside Member

    Joined:
    Jun 25, 2016
    Posts:
    30
    In html5 tho, and also in previous versions (runtime 2.2.0.261) it works as expected, also, when you order instances in the room editor, the draw order is effected by the order they're placed inside the layer, am I the only one who think there's a problem?..
    I guess I'll just report it as a bug and see what happens..
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice