Hey all, I’m working on a puzzle game where objects get moved around in the scene. The scene has 4 ‘states’ where you are given access to about a dozen objects to move around before leaving the level and then coming back to it later.
I was wondering how I can best set up, save and load these states so you could go into a debug menu scene, select the state of the scene you want to go in to, and then load it up?
Update: Thanks for the suggestions guys, but I couldn’t see either DontDestroyOnLoad or PlayerPrefs working very well for the scenario I’m working with. I instead went with a bit of code that just moves the objects into their solved positions during Start() based on the scene state.
//Go through all the pickup+putdown objects and if they've already been solved, move them to their solved position
for(var riddlePreSolved : GameObject in GameObject.FindGameObjectsWithTag("Pick"))
if(riddlePreSolved.GetComponent(ObjectScript))
if(riddlePreSolved.GetComponent(ObjectScript).riddleNumber < RiddleState.riddleState)
{
riddlePreSolved.GetComponent(ObjectScript).pickTarget.transform.parent = riddlePreSolved.transform;
riddlePreSolved.GetComponent(ObjectScript).pickTarget.transform.localRotation = Quaternion(0,0,0,0);
riddlePreSolved.GetComponent(ObjectScript).pickTarget.transform.localPosition = Vector3(0,0,0);
}