edited May 2022 in ORK Scripting
Hi,
I used to save game via script in ORK2 but I found that it's a bit different from ORK3?


public static void Save(){
// ORK.SaveGame.Save(ORK.SaveGame.LastIndex);
// ORK.SaveGame.CreateInfos();
ORK.Game.SaveGame();
ORK.SaveGame.AddSaveData();

Maki.SaveGame.Save(Maki.SaveGame.LatestSaveIndex);
Maki.SaveGame.Save(Maki.SaveGame.LastIndex);
Maki.Game.SaveGame();
}


I'm not sure which method above should I use? In ORK2 I used the commented 2 lines to save game.
Should I use ORK or Makinom's save handler, or use them both?

Edit:
I use the code above, and load the game using Start Menu's Continue option, it will load the saved scene but the player won't spawn, there is spawn point and ORK Starter in the scene.
Post edited by bitmore on
  • In ORK 3, save games are handled by Makinom, i.e. you can save it via Maki.SaveGame.Save(index), index being the save file index.

    Loading a save game will spawn the player at the saved position, unless you disabled Group Positions in the ORK save settings (UI > Save Game Settings).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited May 2022
    @gamingislove Thanks for your reply.
    I'm still having the issue that the player won't spawn.
    I use the code to save the game:
    public static void Save(){
    int index = Maki.SaveGame.LatestSaveIndex;
    if(index < 0) index = 0;
    Maki.SaveGame.Save(index);
    }

    #if UNITY_2018_1_OR_NEWER
    private void OnEnable()
    {
    Application.wantsToQuit -= OnWantsToQuit;
    Application.wantsToQuit += OnWantsToQuit;
    }

    private void OnDisable()
    {
    Application.wantsToQuit -= OnWantsToQuit;
    }

    private bool OnWantsToQuit()
    {
    Save();
    return true;
    }
    #else
    /// <summary>
    /// When quitting, save the game.
    /// </summary>
    private void OnApplicationQuit()
    {
    Save();
    }
    #endif


    Both Continue and Load options can jump to the saved scene but can not spawn the player.

    The UI > Save Game Settings are set to Save Slots = 3, Auto Save Slots = 1. The Group Position and Player Position are enabled.
    Post edited by bitmore on
  • edited May 2022
    I think I found the problem: I save the game in OnApplicationQuit/Application.wantsToQuit, maybe ORK 3 release the combatants before I save them?

    It's working perfectly while saving in SceneManager.sceneLoaded.
    Post edited by bitmore on
  • Probably - not sure when application quit is called, but if things in the scene are already destroyed, etc., it might be too late at that point.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.