If you do this remember to free the old one (or have some way of accessing it) since the engine won’t do it for you

    • Ategon@programming.devOPM
      link
      fedilink
      arrow-up
      8
      ·
      edit-2
      7 days ago

      It definitely has more niche use due to the children interactions. Its pretty much just a shorthand for one specific case of function calls you would do so that you dont have to mess with all of reparenting, position, etc. for that case

      Its more useful for engine and tool development (and is used in the engine for the change type button when you right click)

      Off the top of my head a use case in a game would if for some reason you have placeholders, replacing the placeholder with the actual node. Another one is if your enemies change based on a specific metric in the game (e.g. one a run hits 1 minute all enemies change to be a harder enemy), you can just replace the old enemy node/script with the new one so that you get the updated script (would have to also manage the sprite in that case though)

    • popcar2@programming.dev
      link
      fedilink
      arrow-up
      3
      ·
      7 days ago

      Not sure about the context of a game, but I’ve used this to replace some UI nodes when the game switches to portrait mode on mobile. Sometimes it’s just easier to use different containers.

    • insomniac_lemon@lemmy.cafe
      link
      fedilink
      English
      arrow-up
      1
      ·
      7 days ago

      Using nodes to compose art (or even component-based code?) would be my guess. Though sure, for many scenarios/designs a node swap wouldn’t be needed.