Is there a way to run a pop-up box only the first time an app is opened?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By thecolorfive

I’ve seen pop-up type tutorials for how an app works, in various windows and android apps, that is only shown the first time an app runs. I mean the type of thing that frequently has a “don’t show this again” check box option, but not always. What would it take to get such a thing working? Also, would something like this cause the app to require storage access that the app would otherwise not?

:bust_in_silhouette: Reply From: Jummit

You should be able to use the user:// directory to save and load files.
For example, using ConfigFile:

# on startup
var config =
var err = config.load("user://settings.cfg")
if err == OK:
	var show_popup = config.get_value("startup", "show_popup", true)
	# show the popup if `show_popup` is true"user://settings.cfg")
	# couldn't load config file, show the popup

# when `don't show again` is pressed:
config.set_value("startup", "show_popup", false)
:bust_in_silhouette: Reply From: deaton64


I would save a value in a config file and check if that value has been set. You can use the Config file object to do this.

Here’s some quick code that will do that. There’s no error checking, but it does what it needs to do. The config file is saved (in Window) in C:\Users\USERNAME\AppData\Roaming\Godot\app_userdata\GODOT PROJECT NAME

extends Node2D

var only_show_once = false
var config_file = "user://settings.cfg"

func _ready():
	var directory =;
	if !directory.file_exists(config_file):
		print("Config file doesn't exist")
	if only_show_once:
		print("This isn't the first time this app has been run")
		print("First run. Add some code to show a popup box.")
		only_show_once = true

func load_config(filename):
	var config =
	only_show_once = config.get_value("config", "only_show_once")

func save_config(filename):
	var config =
	config.set_value("config", "only_show_once", only_show_once)

The above code creates a text file that looks like this:



You can edit that with a text file and set the value back to false to check it works as expected.
You can also save other config values to that file.