Save progress in game (or instantiate persistent game object?)

Hi
I wanna making game that is based scenario like Lifeline game. I made everything excluding one thing.

I cant save progress in game. My game’s logic is instantiate.

Player clicks button and texts come in prefabs.

If I exit my game and reopen it, instantiated gameobjects disappear.

How do I instantiate persistent?

any idea? @slackmoehrle
because my game finished and I have to save player’s progress… if I dont save progress, there is no mean to play my game…

because it is text based scenario game

I tried this way:

onLoad: function () {
    var ls = cc.sys.localStorage;

    var scene = cc.director.getScene()
    //ls.setItem("sceneValue", scene) I stored it as sceneValue
    var s = ls.getItem("sceneValue")

    cc.director.runScene(s)

},

but it gives this error in browser:

CCDirector.js:911 Uncaught TypeError: this._runningScene.onEnter is not a function

in simulator it gives this error:

Simulator : Assert: the scene should not null
Simulator : Assert failed: the scene should not be null

omg! haha, it not like you create scene and just save it … zzz

you must to understand how that scene work, then save all attribute and data of current scene to “a file” or some where you like.

load game must be a function read all that attribute and data then fill it to a new scene. that can able to continue run the game.

I understood the logic of scene work, but not found anything about what method I can use… :slight_smile:

So, you suggest json or xml etc? but in my game there will be 700-800(maybe 7-8k it is not exact value) game node(labels and buttons). I thought json but it seemed interesting and a bit heavy for game. Because according to nodes in my game, the json or xml file’s size will be very big.

you must to write your self save and load API for your game because just you understand it right ?.
there is no wrote method that already here to be use.
you can save using localStorage or anything ( i’m not using Creator anyway.). here is an example:
like i have a tile map: i can save each position of tile map and tile id to a file maybe json or xml. then load it back. same logic as your game.
if you don’t mind you can tell me what you have in your scene so maybe i can help.