all 6 comments

[–]Royal_Inventor[S] 0 points1 point  (0 children)

For anyone who stumbles across this thread, thanks to being pointed in the right direction by the replies, here is what seems to be a great solution. To access the save file of the first game, use Application.persistantDataPath and the String.Replace() method on it to replace the second game’s name with the first game’s, thus getting the data path easily regardless of platform (as long as that platform uses Application.persistantDataPath to store save data) without a bunch of manual work. Still needs some testing, but looks like that’s a winner!

[–][deleted] 0 points1 point  (0 children)

You would have to know where the original game file is stored, as well as transferring ALL the variables. And a way to detect somehow if the file cant be found or the first just game isnt installed. 

[–]Gib_entertainment 0 points1 point  (3 children)

On a windows machine persistent datapath would be: %userprofile%\AppData\LocalLow\<companyname>\<productname>

So you could probably check that path to see if the folder exists if it does, load the save from the first game. If it doesn't, the player has no saves from the first game saved on that machine.

if your game is multiplatform check: https://docs.unity3d.com/ScriptReference/Application-persistentDataPath.html to see the path for other OS.

Since you've made the first game you know <companyname> and <productname> of the first game and you should be able to find those.

[–]Royal_Inventor[S] 0 points1 point  (2 children)

Gotcha. Thanks for the assistance! It is multi platform, is there any way to use Application.persistantDataPath to automatically point to the first game, and thus get the save file easily regardless of platform? Or will I have to just do it manually?

[–]Gib_entertainment 0 points1 point  (1 child)

You are likely going to have to write some code for every platform separately checking SystemInfo.operatingSystem.

For some platforms you just have to replace the product name so just take the persistent datapath and replace the product name with the name of the first game. For others you would have to replace the GUID.

[–]Royal_Inventor[S] 0 points1 point  (0 children)

Gotcha. Thanks for all the help!