You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
681 B
22 lines
681 B
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
|
||
|
public class SaveSystemSetup : MonoBehaviour {
|
||
|
|
||
|
[SerializeField] private string fileName = "Profile.bin"; // file to save with the specified resolution
|
||
|
[SerializeField] private bool dontDestroyOnLoad; // the object will move from one scene to another (you only need to add it once)
|
||
|
|
||
|
void Awake()
|
||
|
{
|
||
|
SaveSystem.Initialize(fileName);
|
||
|
if(dontDestroyOnLoad) DontDestroyOnLoad(transform.gameObject);
|
||
|
}
|
||
|
|
||
|
// if the object is present in all game scenes, auto save before exiting
|
||
|
// on some platforms there may not be an exit function, see the Unity help
|
||
|
void OnApplicationQuit()
|
||
|
{
|
||
|
SaveSystem.SaveToDisk();
|
||
|
}
|
||
|
}
|