Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Making and referring from text files

Discussion in 'Editor & General Support' started by SuperMutantHero, Jun 25, 2021.

  1. SuperMutantHero

    SuperMutantHero

    Joined:
    Jun 23, 2020
    Posts:
    3
    So I'm making a game and I'm trying to include a system where an intro plays when the game is loaded up, but the intro will only ever play once. Based on other big games I've played, I know they may often refer from a notepad file. For example, in FNAF 6, you can increase the monetary value, and after a reload, the value is the number you put in (I'm sorry, I'm going off on a tangent. Anyway, I have not a clue where to start, so any advice would be appreciated!
     
  2. Janette5

    Janette5

    Joined:
    Dec 14, 2020
    Posts:
    15
    You need a way to save your game - you can either use Unity's method or find some useful tools in the Unity Asset Store that make saving your game easy.

    Next you can make the intro part of your save system

    If the save file exists - skip the intro - because the player has played before.
    If the save file does not exist - this is the first time the player is playing the game, then play the intro and save something to create the save file.

    Or alternatively set a variable when you have played the intro, and test that variable at start.
     
  3. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    Look up PlayerPrefs, it's the basic system for saving and loading values in Unity. No need to muck around with text files.