https://linen.dev logo
Join Discord
Powered by
# ceramic
  • a

    ambitious-knife-25690

    02/10/2023, 5:42 PM
    ohhh, you mean just not used it lol?
  • a

    ambitious-knife-25690

    02/10/2023, 6:24 PM
    @billowy-waiter-28954I just tried switching back to a previous scene set as
    main
    but it seems like ceramic destroys previous scene instances
  • a

    ambitious-knife-25690

    02/10/2023, 6:24 PM
    is this behaviour togglable?
  • a

    ambitious-knife-25690

    02/10/2023, 6:34 PM
    maybe i'm misunderstanding how to handle scene switching in ceramic 🤔
  • f

    faint-toothbrush-51643

    02/10/2023, 7:54 PM
    it seems to be not togglable. look at "set" https://github.com/ceramic-engine/ceramic/blob/master/runtime/src/ceramic/SceneSystem.hx
  • a

    ambitious-knife-25690

    02/10/2023, 8:12 PM
    huh, guess i don't understand how the scene system is meant to work
  • f

    faint-toothbrush-51643

    02/10/2023, 9:32 PM
    what are you trying to do?
  • a

    ambitious-knife-25690

    02/10/2023, 9:40 PM
    just change scenes and keep the state of the old scene
  • b

    billowy-waiter-28954

    02/10/2023, 11:08 PM
    The idea of assigning a main scene (with
    app.scenes.main = new SomeScene()
    ) is to manage resources and memory
  • b

    billowy-waiter-28954

    02/10/2023, 11:08 PM
    So yeah, if you assign a new main scene, the previous one will fade out and be destroyed
  • b

    billowy-waiter-28954

    02/10/2023, 11:09 PM
    So if you want to "go back" to that scene
  • b

    billowy-waiter-28954

    02/10/2023, 11:09 PM
    you need to instanciate a new one
  • b

    billowy-waiter-28954

    02/10/2023, 11:09 PM
    (which is fine)
  • f

    faint-toothbrush-51643

    02/10/2023, 11:09 PM
    or if you're changing scenes with the intention of going back soon, you should use a different layer and make the current one inactive?
  • b

    billowy-waiter-28954

    02/10/2023, 11:10 PM
    If you want to keep a scene around all the time, you can do it, you simply need to assign it to another slot with
    app.scenes.set('slotname', myScene);
  • b

    billowy-waiter-28954

    02/10/2023, 11:10 PM
    (and if you assign another scene to the
    slotname
    slot, then same rule applies as when assigning another scene to `main`: the previous scene fades out and is destroyed)
  • a

    ambitious-knife-25690

    02/10/2023, 11:14 PM
    This seems like a different thing though, because a secondary scene isn't really 'secondary'. Its more like a scene group. I'm mostly trying to understand the intended workflow... Oh! I think I get what you mean
  • a

    ambitious-knife-25690

    02/10/2023, 11:17 PM
    Copy code
    hx
    ...set('a', scene_a);
    ...set('b', scene_b);
    
    scenes.main = scene_a;
    
    buttonClick() {
      scenes.main = scene_b;
    }
  • a

    ambitious-knife-25690

    02/10/2023, 11:17 PM
    this would cause the scene's to persist, right?
  • a

    ambitious-knife-25690

    02/10/2023, 11:18 PM
    I don't get this though, because adding a secondary scene is rendered onto the main scene
  • a

    ambitious-knife-25690

    02/10/2023, 11:18 PM
    so it isn't really the same thing
  • f

    faint-toothbrush-51643

    02/10/2023, 11:19 PM
    or would it be more like this?
    Copy code
    hx
    ...set('a', scene_a);
    ...set('b', scene_b);
    scene_a.active = true;
    scene_b.active = false;
    buttonClick() {
      scene_a.active = false;
      scene_b.active = true;
    }
  • b

    billowy-waiter-28954

    02/10/2023, 11:20 PM
    No you should not assign the same scene to
    main
    and to another slot with
    set('blah', ...)
  • b

    billowy-waiter-28954

    02/10/2023, 11:20 PM
    Basically, doing
    app.scenes.main = ...
    is the same as doing
    app.scenes.set('main', ...)
  • b

    billowy-waiter-28954

    02/10/2023, 11:21 PM
    Yes this seems more correct if you want to keep your scenes in memory
  • a

    ambitious-knife-25690

    02/10/2023, 11:22 PM
    ahah, that works
  • a

    ambitious-knife-25690

    02/10/2023, 11:22 PM
    so ceramic's flow is essentially. Everything is handled in the
    MainScene
  • a

    ambitious-knife-25690

    02/10/2023, 11:22 PM
    (more or less)
  • f

    faint-toothbrush-51643

    02/10/2023, 11:34 PM
    hey, that wasn't so hard
  • a

    ambitious-knife-25690

    02/10/2023, 11:34 PM
1...626364...124Latest