Changing scenes | Godot 4

Sdílet
Vložit
  • čas přidán 23. 08. 2024
  • The video goes over changing a scene in Godot 4,
    using change_scene_to_file and change_scene_to_packed.
    #godot #gamedev #gameengine

Komentáře • 46

  • @Emka877
    @Emka877 Před 8 měsíci +5

    Wow i love the not too long video + the calming voice that is not speaking at a 300 words per seconds rate + the visuals!!
    TYVM!

  • @agriasoaks6721
    @agriasoaks6721 Před rokem +15

    Thank you so much for this, Sensei! 🙏🙏🙏

  • @captaincabri
    @captaincabri Před 7 měsíci +4

    World class level format and explanations videos for core concepts of Godot. Great great job. Thank you for doing this !

  • @tuliardo269
    @tuliardo269 Před 17 dny

    you saved me a lot of time. Thank you!

  • @raysandrarexxia941
    @raysandrarexxia941 Před 6 měsíci +2

    The old scene is still in memory. I'm trying to figure out how to completely reset the previous scene (I'm using change_scene_to_file).

    • @JumboGamedev
      @JumboGamedev  Před 6 měsíci +3

      According to the documentation, change_scene_to_file deletes the current scene.
      From the documentation: "We can delete the existing scene. SceneTree.change_scene_to_file() and SceneTree.change_scene_to_packed() will delete the current scene immediately."
      Source: docs.godotengine.org/en/stable/tutorials/scripting/change_scenes_manually.html
      Maybe try using .free() as the documentation says.

  • @Dent42
    @Dent42 Před rokem +3

    Excellent explanation! Thanks!

  • @uoyredrum
    @uoyredrum Před 27 dny

    Extremely helpful, thanks!

  • @kagenek0
    @kagenek0 Před 9 měsíci +2

    Whenever I switch back, it stops working.
    Like, if I'm on scene1, then switch to scene2, then back to scene1, it stops working. I can't go back to scene2.
    This is the error that I'm getting:
    emit_signalp: Error calling from signal 'pressed' to callable: 'Button::_on_pressed': Method not found.

    • @JumboGamedev
      @JumboGamedev  Před 9 měsíci

      This looks like the method `_on_pressed` is not defined in the script attached to the Button node.

    • @kagenek0
      @kagenek0 Před 9 měsíci

      @@JumboGamedev How could that be? It's literally the exact same scene I used to switch to another scene. How come the method is not defined this time around?

    • @JumboGamedev
      @JumboGamedev  Před 9 měsíci

      @@kagenek0 This was the first thing that came to my mind based on the error, but it is hard to know exactly why because I don't have enough information. But my guess is that if you are changing the scenes, there could be something difference in the way you initialize the scene from the first time compared to the second time, because everytime you change the scene, you get a new instance.

  • @AprendaGodot
    @AprendaGodot Před rokem

    Thanks bro, it helped me a lot 😁

  • @mrussoart
    @mrussoart Před 11 měsíci

    Perfect

  • @sheepcommander_
    @sheepcommander_ Před 10 měsíci

    Ty onii-sama

  • @santoshgujar5237
    @santoshgujar5237 Před 11 měsíci

    Thank you, Sir, 🙏🌺😇

  • @Peter-wl5xm
    @Peter-wl5xm Před 10 měsíci +2

    Ty onii-chan

  • @JFran.
    @JFran. Před 4 měsíci

    Thanks man

  • @GonzaguePATINIER
    @GonzaguePATINIER Před rokem +3

    Nice. What tools do you use for the animation?

    • @thebeast024
      @thebeast024 Před rokem +1

      he said somewhere it was after effects i think

  • @dryzoFy
    @dryzoFy Před 3 měsíci

    skibidi sensei would be proud of you

    • @JumboGamedev
      @JumboGamedev  Před 3 měsíci

      Thanks! I'll keep doing my best to make Skibidi Sensei proud!

  • @Jack317_
    @Jack317_ Před 10 měsíci

    im having a problem with this, for me it only works once and then it stops working

    • @JumboGamedev
      @JumboGamedev  Před 9 měsíci

      Which part?

    • @Jack317_
      @Jack317_ Před 9 měsíci

      change scene to file and change scene to packed@@JumboGamedev

  • @thesomeone2nd
    @thesomeone2nd Před 9 měsíci

    Hello I have a question. What's the best way to access a scene multiple times? E.g. if I want from th main menu to go to an options scene back and forth multiple times. Cause the simple change scene functions doesn't work when there is more code there.

    • @JumboGamedev
      @JumboGamedev  Před 9 měsíci +2

      If you want to access the same scene multiple times, you can hide the scene, and then show it back when you need it. Or you can remove the scene from the sceneTree, then attach the scene back when you need it.

    • @thesomeone2nd
      @thesomeone2nd Před 9 měsíci

      @@JumboGamedev Thanks for the help dude. I also found another way to deal with it now but I could try those. How you mean tho to hide it or remove it from the scene tree? I mean from which script you do that?

    • @JumboGamedev
      @JumboGamedev  Před 9 měsíci +2

      @@thesomeone2nd You are very welcome!
      You can do that in the script of the main menu. You can have an instance of the options scene in the main menu scene. You can then set the visibility property of the root node of the options scene to false Or you can remove it using remove_child() on the parent node of the options scene.

    • @thesomeone2nd
      @thesomeone2nd Před 9 měsíci

      @@JumboGamedev alright thank you very much for the explanation have a good day

    • @JumboGamedev
      @JumboGamedev  Před 9 měsíci +1

      @@thesomeone2nd You are very welcome. You Too!

  • @jeenu815
    @jeenu815 Před 9 měsíci

    i tired to get a path with resource var with c# scipt :BAD IDEA it can courpt ur data so dont try it and use string for now