Maris Posted December 26, 2014 Share Posted December 26, 2014 There are OnSave and OnLoad for each object. But what if I need to store info about world? For example, I need to save coordinates of place where deerclops was killed. Link to comment Share on other sites More sharing options...
rezecib Posted December 26, 2014 Share Posted December 26, 2014 (edited) @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 December 26, 2014 by rezecib Link to comment Share on other sites More sharing options...
Maris Posted December 26, 2014 Author Share Posted December 26, 2014 (edited) 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 December 26, 2014 by Maris Link to comment Share on other sites More sharing options...
rezecib Posted December 26, 2014 Share Posted December 26, 2014 @Maris, Pig king is not guaranteed. I added someone else you need for it to save above. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now