- Home /
Game Foundation: C# "using" namespace error
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:
using UnityEngine;
using UnityEngine.GameFoundation;
public class SaveGame : MonoBehaviour
{
IDataPersistence localPersistence;
void Awake()
{
// choose what format you want to use
JsonDataSerializer dataSerializer = new JsonDataSerializer();
// choose where and how the data is stored
localPersistence = new LocalPersistence(dataSerializer);
// tell Game Foundation to initialize using this
// persistence system. Only call Initialize once per session.
GameFoundation.Initialize(localPersistence);
}
public void Save()
{
GameFoundation.Save(localPersistence);
}
public void Load()
{
GameFoundation.Load(localPersistence);
}
}
But I'm having this problem:
Any help will be appreciated!
Comment
Answer by StringAtlas · Dec 11, 2020 at 03:50 AM
Did you install the package yet? In the newer versions of Unity, you can do so by Window > Package Manager > Unity Registry, then search Game Foundation (make sure that preview packages are turned on under the "Advanced" drop down menu).
Your answer
![](https://koobas.hobune.stream/wayback/20220613021323im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
The name "Game Foundation" does not exist in the current context 1 Answer
Unity 3D 2018.1 - Save 0 Answers
Multiple Cars not working 1 Answer
Calling C# Namespace from Boo 1 Answer