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. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here: unity.com/legal/terms-of-service.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice
  4. Join us on Thursday, September 29, for a day with Unity's SRP teams here on the forum or on Reddit, and discuss topics around URP, HDRP, and the Scriptable Render Pipeline in general.
    Dismiss Notice

Question The name "Game Foundation" doesn't exist in the current context.

Discussion in 'Game Foundation' started by Melanzue, Dec 9, 2020.

  1. Melanzue

    Melanzue

    Joined:
    May 12, 2020
    Posts:
    8
    Hi! I'm trying out Game Foundation and I want to save all the changes that are made in Runtime. So I found this code in the official tutorial:
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using UnityEngine.GameFoundation;
    4. public class SaveGame : MonoBehaviour
    5. {
    6.      IDataPersistence localPersistence;
    7.      void Awake()
    8.      {
    9.          // choose what format you want to use
    10.          JsonDataSerializer dataSerializer = new JsonDataSerializer();
    11.          // choose where and how the data is stored
    12.          localPersistence = new LocalPersistence(dataSerializer);
    13.          // tell Game Foundation to initialize using this
    14.          // persistence system. Only call Initialize once per session.
    15.          GameFoundation.Initialize(localPersistence);
    16.      }
    17.      public void Save()
    18.      {
    19.          GameFoundation.Save(localPersistence);
    20.      }
    21.      public void Load()
    22.      {
    23.          GameFoundation.Load(localPersistence);
    24.      }
    25. }
    But I'm having this problem:

    Any help will be appreciated!
     
  2. U_AdrienPDB

    U_AdrienPDB

    Unity Technologies

    Joined:
    Aug 14, 2019
    Posts:
    7
    Melanzue and erika_d like this.
  3. Melanzue

    Melanzue

    Joined:
    May 12, 2020
    Posts:
    8
    @U_AdrienPDB , thank you so much! I've been searching for the updated tutorial but couldn't find it on my own. Now I can finally continue working on my project!
     
    tony_c-unity3d and erika_d like this.
unityunity