Save and Load Settings in Godot 4 with ConfigFile | Let's Godot

Поділитися
Вставка
  • Опубліковано 14 січ 2025

КОМЕНТАРІ • 68

  • @DashNothing
    @DashNothing  10 місяців тому +8

    Thanks so much for watching! Join the community:
    discord.gg/wtfeeQaQVx
    Hope to see you there!

    • @Mika43344
      @Mika43344 2 місяці тому

      The only question is why you didn't use resources for that? I'm new in Godot that's why I'm asking, please explain

    • @DashNothing
      @DashNothing  2 місяці тому

      @@Mika43344 Resources are useful to define a data type that will be used multiple times. We aren't saving multiple configurations, but only one. Using a resource is redundant here.

    • @Mika43344
      @Mika43344 2 місяці тому

      ​@@DashNothingok, what about if I want to create key binds for keyboard+mouse and xbox controller and ps controller?

    • @DashNothing
      @DashNothing  2 місяці тому

      @Mika43344 That could be a use case for a custom resource, but ultimately up to you

  • @jjab7996
    @jjab7996 Місяць тому +2

    After looking for hours all over the internet and finding millions of videos that either were too complicated for a beginner, or didn't solve what i wanted, this one is the one I needed to finalize my game, it was literally the only thing left, so thank you very much!

  • @Swinkly_
    @Swinkly_ 6 місяців тому +5

    I can't even say how grateful I am for a tutorial that was this concise and clear for adding remappable controls. I've been working on a high-speed platformer, and almost everyone who's playtested it wished they could configure the controls differently - so I watched two of your tutorials and the entire system is taken care of. Thank you SO much for this!

  • @yourstruly2728
    @yourstruly2728 10 місяців тому +7

    I always look forward to your videos dude.

  • @arcanealchemist3190
    @arcanealchemist3190 2 дні тому

    very good video. after struggling to understand the godot tutorial webpage on it, watching how you implemented it made everything more understandable. thanks

  • @Zurpanik
    @Zurpanik Місяць тому

    Fantastic work my friend! Thank you for the great technique implementation for Godot!

  • @phare87
    @phare87 9 днів тому

    thank you for this video, was very helpful

  • @AviaoNavegador
    @AviaoNavegador 27 днів тому

    thank you so much bro, you helped me a lot. Folowing you right now

  • @lethn2929
    @lethn2929 6 місяців тому +4

    In case anyone is wondering how to do a drop down options menu, use the item_selected signal in the OptionsButton node, this threw me off, you can save and load the selected integer.
    Edit: Hadn't realised this answer had been buried in the comments section but I think it's worth repeating lol means you can do proper resolution options among other things.

  • @meatyred1611
    @meatyred1611 9 місяців тому +2

    Do gravity, Boids, and object orbiting next I love to see a video like that :)

  • @redswrath4813
    @redswrath4813 8 місяців тому +1

    I hope you can make a video on camera smooth positioning and hit effects ( anyway, keep up the good work ! )

    • @DashNothing
      @DashNothing  8 місяців тому

      I got a video on a dynamic twin stick shooter camera such as in Enter the Gungeon. I also have videos for a hit flash and hit stop effects. Check them out if it sounds interesting.

  • @edowardo1353
    @edowardo1353 6 місяців тому

    This saved my life, thank you so muchhh

  • @meowtube91
    @meowtube91 9 місяців тому

    your tutorials Are very helpful. ^^ can you make a shaking screen when the enemy is damaging you or vice versa ^^

  • @CescosGames
    @CescosGames Місяць тому

    thank you for the tutorial, this helped me understand CONFIG files. Question for anyone on MacOS - are you able to locate the "user://" file in your system? I can't find it following the Godot documentation path for MacOS

  • @stevedexa
    @stevedexa 10 місяців тому +3

    what is your keyboard?

    • @DashNothing
      @DashNothing  10 місяців тому +4

      I use a program called MechaKeys to play sounds as I type in order to simulate the sound of a keyboard to spice up the videos. The preset is Blueberry MX, so I'm sure those keycaps sound similar irl.

    • @stevedexa
      @stevedexa 9 місяців тому +3

      @@DashNothing I didn't even know programs like this existed, thanks

  • @L-D-O-E-S
    @L-D-O-E-S 10 місяців тому

    Nice videoo ❤❤

  • @N-.-A
    @N-.-A 6 місяців тому +1

    Great tutorial really appreciate it. I was thinking, why make 2 functions(save/load) for each section. Would it not be smarter to implement a SECTION parameter for each the functions instead. That way only 2 functions needed. Then make a const for each section.

    • @DashNothing
      @DashNothing  6 місяців тому

      @@N-.-A Yes, that does make sense, but since the keybindings saving / loading is so different from the others I decided to just make a seperate function for each.

    • @N-.-A
      @N-.-A 6 місяців тому

      @@DashNothing Got ya. Ty for the reply

  • @ypaut
    @ypaut 3 місяці тому

    thanks!

  • @Noky98
    @Noky98 7 місяців тому

    14:16 lipo da ima još neki naš u Godotu :)

  • @lethn2929
    @lethn2929 6 місяців тому

    Another point, this may just be because of my node/code execution order but I found I would get out of bounds error messages for my dictionary when I tried setting the options, putting a timer in solved this problem so it may have simply been the dictionary not loading up fast enough.

    • @goncalokai
      @goncalokai 10 днів тому

      can you help me, Im getting those dictionary errors too but I dont know how to fix them

  • @jasonwilliams8730
    @jasonwilliams8730 10 місяців тому

    👍

  • @sturesvensson4097
    @sturesvensson4097 3 місяці тому +2

    Could someone help me. I followed the tutorial for both input remapping and this one. I have checked three times for mistakes in my code but I found nothing wrong. Though I still get this weird issue when running the game. All mouse inputs shows up as (Unset) except for when pressing the reset button. I am using Godot Version 4.2.2. But still, thanks for the amazing tutorials.

  • @MrJekkoGaming
    @MrJekkoGaming 8 місяців тому

    Thank you so much for this tutorial. i had struggle to understand what "video" and "fullscreen" do in the code. it took me couple replays of your video for me to finally get it. yea your code is works but i wanted to understand WHY? why it's works yk? im beginner . its been 2 week i learning coding but i still dont understand what " {} " for ? in this code var music_settings = {} . what's that bracket thing {} means?

    • @DashNothing
      @DashNothing  8 місяців тому +3

      《》 means we created a dictionary (docs.godotengine.org/en/stable/classes/class_dictionary.html). I understand it's difficult, especially with no prior coding knowledge. Many beginners don't really care why something works, they just copy it and don't learn anything. You're doing great trying to understand it.

  • @inkshiftofficial
    @inkshiftofficial 9 місяців тому

    Can you make video on gun recoil, so that every gun sprite don't have to be animated for shoot animation instead we can add recoil using code

  • @ChillySmalls2910
    @ChillySmalls2910 3 місяці тому

    can you do a version with an options button, i have resolution implemented in my game and i just cant figure it out

    • @DashNothing
      @DashNothing  3 місяці тому

      @@ChillySmalls2910 You should save the index of the selected option. You get it in the OptionButton's selected signal callback

    • @ChillySmalls2910
      @ChillySmalls2910 3 місяці тому

      @@DashNothing thanks

  • @sorsx
    @sorsx 2 місяці тому

    hello mr.dash your work is perfect and it saved my settings files but it cant load it in the game , yes its saving it but i dont know if the reason is your code or my version since i use 4.3 and most of the codes changed , can you please help me? i will really wait for your replay.

    • @DashNothing
      @DashNothing  2 місяці тому +1

      @@sorsx Thanks. This was made on 4.2 so none of the code needs to change for this to work. It's more than likely that you missed or mistyped a part of the loading code. Your best bet is going through that part again and double check you have everything setup correctly.

    • @sorsx
      @sorsx 2 місяці тому

      @DashNothing Thank you so much mister! Could you please... Share the code? It would be so helpful for us! We really need it, Thank you!

  • @ulfbereth342
    @ulfbereth342 Місяць тому

    When we change the 'forward' key to 'T' and then restart the game, it still works with the 'W' key unless we open the settings menu. How can I fix this issue?

    • @DashNothing
      @DashNothing  Місяць тому

      @@ulfbereth342 the _load_keybindings_from_settings() does that. In my case it is called in the ready func of the input settings scene. If your input settings isn't instantiated before you open it up make sure to have a function like that called at the start of your game, perhaps from an autoloaded singleton.

  • @darkproductions65
    @darkproductions65 2 місяці тому

    an thought. When i get into the SETTINGS_PATH part, to save the cfg file or load it... if i write any other things in the path like i meant to create folders, will it create the folders? Or, if instead of user://, i write /storage/0/..., will it get that i want to make the file in the android system and create it?

    • @DashNothing
      @DashNothing  2 місяці тому

      @@darkproductions65 You should still use user:// as that is the default save path Godot defines, regardless of the OS. Not sure what that is on android, but it is specified in the documentation.
      As for adding directories to the path - yes that should work.

    • @darkproductions65
      @darkproductions65 2 місяці тому

      @@DashNothing can you do an tutorial or overview about DirAccess? it is specified in the Godot Documentation and is updated to 4.0, but i don't see anybody talk about it. And as it says it is used mainly to create folders and subfolders, maybe combined with FileAccess it should make a "Writing Dir and Files System"?

  • @dhdr27
    @dhdr27 6 місяців тому

    Any idea what to do if the error „Cannot get keys form nonexistent section section „audio“ appears. A triple checked for Typos. And in the ini file itself I can see the settings. And Audio is typed correctly.

    • @dhdr27
      @dhdr27 6 місяців тому

      i got it
      Soo in Project_Settings: Autoload:
      My C_FileManager was bellower then the setting_Menu_Autoload. So i trys first to read the Settting.ini before is load and opened in the C_File Manager

  • @Ruder08
    @Ruder08 2 місяці тому

    how to save gamepad buttons?

  • @Tamim_hariri
    @Tamim_hariri 10 місяців тому

    can you make video about wave system

    • @DashNothing
      @DashNothing  10 місяців тому +1

      Good idea, I'll see what I can do

  • @murraymon
    @murraymon 6 місяців тому

    with the check box, it saves and loads wither or not it was toggled just fine, but if it was toggled and then i switch to a new scene or close and reopen the game, it doesn't read as if it's been pressed, and turns off whatever the check box toggles, even though the check box shows as being on, so i have to click it to get rid of the check mark, and then check it again. Any idea what could be causing this?

    • @Mika43344
      @Mika43344 2 місяці тому

      on ready you have to emit signal, so when start the game emit this signal

  • @goncalokai
    @goncalokai 10 днів тому

    I have some Dictionary errors at
    func _ready() -> void:
    var video_settings = Config.load_video_settings()
    fullscreen.button_pressed = video_settings.fullscreen #this one

    var audio_settings = Config.load_audio_setting()
    volume.value = min(audio_settings.volume, 1.0) * 10 #this one
    does anyone know how to fix?

  • @trueblue97
    @trueblue97 3 місяці тому

    Anyone know how to save a config with an android app, as opposed to a PC application?

  • @connorjade5460
    @connorjade5460 9 місяців тому

    How can I use this with option button (enum one) in godot 4 UI??

    • @DashNothing
      @DashNothing  9 місяців тому

      I answered on your post in discord

    • @connorjade5460
      @connorjade5460 9 місяців тому

      @@DashNothing I've checked by running the code. Though it is saving the id in correctly, but when you restart the game, the game reverts back to the default language settings

  • @Frandibujacosas
    @Frandibujacosas 8 місяців тому

    how can you save the translations of tre language selected? Thank you!

    • @DashNothing
      @DashNothing  8 місяців тому +1

      You wouldn't save the translations in the same file you save your settings, but you can save the id of the OptionButton option you selected. Then you could load a language based on that.

  • @coffeecatrailway
    @coffeecatrailway 5 місяців тому

    Do you upload the source code anywhere?

    • @DashNothing
      @DashNothing  5 місяців тому

      @@coffeecatrailway No, not currently

  • @DannyArchive
    @DannyArchive 9 місяців тому +2

    Was this bit in the input settings changed from the input video, or did I miss it?
    for action in input_actions:
    if InputMap.action_has_event(action, event):
    InputMap.action_erase_event(action, event)
    var buttons_with_action = action_list.get_children().filter(func(button):
    return button.find_child("LabelAction").text == input_actions[action]
    )
    for button in buttons_with_action:
    button.find_child("LabelInput").text = ""

    • @DashNothing
      @DashNothing  9 місяців тому +3

      No, it wasn't there in the first video. That part was added when a viewer ask how to limit one key per action so that multiple actions can't share the same key. It deletes the input events from the actions in InputMap and clears the text of the corresponding buttons.

    • @DannyArchive
      @DannyArchive 9 місяців тому

      @@DashNothing oh okay it was just I don't think you showed adding it and said that it was the same as the keybindings video, so I got confused, xD maybe add comment of timestamp and code that was added if anyone else has the same issue. Your channel is great, keep it up