Hi, my game doesnt have main menu, just simply levels, when players opens the game i want to continue from last session scene(level) . how do i create binary file(or using playerprefs) . could you please help me how to save scene and load here in my game using binary file. here is my game code. please help me i am stuck here for last few days
public class PlatformBuild : MonoBehaviour
{
void Awake()
{
LoadLevel();
}
public void LoadLevel()
{
float spawnPosZ = -42.86f;
for (int i = 0; i < PlatformsSize; i++)
{
GameObject platform = Instantiate(RandomPlatform, transform);
platform.transform.localPosition = new Vector3(0, 0, spawnPosZ);
platform.transform.localEulerAngles = new Vector3(0, 0, UnityEngine.Random.Range(0, 360));
spawnedPlatforms.Add(platform);
}
GameObject finalPlatformInstance = Instantiate(finalPlatform, transform);
finalPlatformInstance.transform.localPosition = new Vector3(0, 0, spawnPosZ);
}
}
this is my gameManger script,
public class GameManager : MonoBehaviour
{
public void NextLevel()
{
LevelCompletedMenu.SetActive(false); StartCoroutine(LoadFade(SceneManager.GetActiveScene().buildIndex + 1));
}
public void RestartLevel()
{
score = 0;
StartCoroutine(LoadReStart());
GameOver.SetActive(false);
StartCoroutine(LoadFade(SceneManager.GetActiveScene().buildIndex));
}
}