x


How to dynamically save scenes

Hi,

I want to make an FPS with unity.

I am stuck with saving the game (Saving your progress and not the level in the editor).

Theoretically it would be easiest to save the entire scene or level in it's state. When you save it all the scripts, prefabs, models, terrains, particles, animations and variables are DYNAMICALLY saved into a separate file.

Then when you load the game again the scene file is loaded into the game and played on from the suspended saved version.

I would really like an answer to this, the reason I don't want to simply save a few variables to a text file is because my game has tons of stuff packed in it and this would require tons of individual data.

Thanks.

more ▼

asked May 17, 2011 at 11:22 AM

Anonymous game developer gravatar image

Anonymous game developer
26 3 2 3

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

I think I'm working on a similar problem at the moment. The GameObject.FindObjectsOfType function will give you an array of all the objects in the scene.

Currently, I'm writing each object's position, rotation, and scale to disk, then using GameObject.GetComponent to retrieve the objects' MeshFilter component (if it has one) and saving the mesh's name to disk.

I'm hoping not to have to save the actual mesh data to disk, but rather to be able to read in the object's mesh's name and load the mesh itself by name. I've been searching for the answer to that one for a while...

In summary, GameObject.FindObjectsOfType will get you all your scene objects and GameObject.GetComponent will fetch individual components for you. Hope this helps.

more ▼

answered Feb 04, 2012 at 11:36 PM

PeripheralV gravatar image

PeripheralV
1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1124
x1122
x630
x325

asked: May 17, 2011 at 11:22 AM

Seen: 1909 times

Last Updated: Feb 04, 2012 at 11:36 PM