Jump to content

Where to store global data?

Recommended Posts

@Maris, TheWorld.state.myfavoritedeerclopsmemorial



Edit: Oops, you also need this:

AddPrefabPostInit("forest", function(inst) inst.state.myfavoritedeerclopsmemorial = {} end)

WorldState checks if the field exists at all before it populates it from the save data, so you need to just throw something in there so it can do that. There might be a better place to put this, but that's where I had it when I was struggling to figure it out.

Edited by rezecib
Link to comment
Share on other sites

It will not be saved if I restart the game...

Now I'm saving my global data in pigking object. I know that is not correct... However it will save the data if I want to quit.

Edited by Maris
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...