0 votes

Hi everyone,

following Gonkee's tutorial (https://www.youtube.com/watch?v=ldKFOGRQDzo&list=PLl29vQKblxBW8LOP-T4imEtYP0306DF60&index=24)
I set up a little project with a LineEdit Label and two Checkboxes. Tapping a SAVE Button then actually does save the text and the on/off states (among many many other things...), but tapping the LOAD Button won't do a thing. On closing and opening the project again, everything is reset as well.

My game_save.gd contains:

extends Resource

export(bool) var checkbox1_on_off
export(bool) var checkbox2_on_off
export(String) var text_in_label

The code in my overarching Node2D:

extends Node2D

export(Script) var game_save_class

var save_vars = ["checkbox1_on_off", "checkbox2_on_off", "text_in_label"]

func _ready():

func verify_save(world_save):
    for v in save_vars:
        if world_save.get(v) == null:
            return false

func load_world():
    var dir = Directory.new()
    if not dir.file_exists("res://saves/save_01.tres"):
        return false

    var world_save = load("res://saves/save_01.tres")
    if not verify_save(world_save):
        return false

    $CheckBox.bool = world_save.checkbox1_on_off
    $CheckBox2.bool = world_save.checkbox2_on_off
    $Label.text = world_save.text_in_label

    return true

func save_world():
    var new_save = game_save_class.new()
    new_save.checkbox1_on_off = $CheckBox
    new_save.checkbox2_on_off = $CheckBox2
    new_save.text_in_label = $Label.text

    var dir = Directory.new()
    if not dir.dir_exists("res://saves/"):

    ResourceSaver.save( "res://saves/save_01.tres" , new_save) # .res is binary, .tres is text

func _on_SAVE_button_up():

func _on_LOAD_button_up():

The things I'm not sure about to begin with are "bool" and "String" and "text" (in export() var and the load- and save-functions. How to find out what to use there, I wonder?

Help is much appreciated. What am I missing/doing wrong?

it's of course

func _ready():
Godot version 3.2.3
in Engine by (508 points)
edited by

1 Answer

0 votes
Best answer
by (8,548 points)
selected by

In the end I succeeded with this tutorial:

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.