Tell me how to add something for the first time only

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

Please tell me how to add any scene but for visible for first time only for user i am suffering from a week for that
Thank you

:bust_in_silhouette: Reply From: leo-pnt

You can write the content of a variable like var first_time: boolean to a file

  1. user load the app, file does not exists. The global variable first_time has value true
  2. file is created with the value false for the variable
  3. things for the first time are executed
  4. user close the app
  5. the user opens the app, it reads the file and set the global variable first_time to false
  6. first time’s code is not executed

There are multiple ways of writing and reading to a file in Godot. I let you Google that (Json, cfg, binary, etc…)