|
Hey peoples. Basically the title says it all, what would be the best way to save the position of everything in the game world? I currently have the player position and stats saving and loading but I don't know how to approche the gameobjects. Cheers.
(comments are locked)
|
|
There are multiple ways to approach an issue like this. A) Do it the super easy way, save it ALL as a single prefab and create it when you need it. This however has its downsides and it is going to be the same every single time. B) Another method is to save your positions into a set of 2d arrays, which can be complex, but potentially useful. C) (A method I am using right now) You can generate grid patterns by using a set of for loops that create objects with a certain distance between rows and columns. This method however is only useful for creating grids. D) A method that is a mix of A) and B), which is to save the entire environment as a collection of organized prefabs and then use code to spawn them as you need them. These options are how I would deal with such challenges, but undoubtedly there are smarter ways people have devised. D) Is the most logical usually, because you can cut down on the massive lag caused by spawning a huge area of objects. Making 800+ objects all one prefab will generate a massive amount of lag upon creating it(Hence it's downsides).
Apr 28 '11 at 03:23 PM
Craze
Thanks, D is a great option.
Apr 28 '11 at 08:17 PM
jamie
Good job writing a will thought out and correct answer. +1!!!
Apr 29 '11 at 10:21 AM
zmar0519
Just happy to help :D
May 04 '11 at 06:50 PM
Craze
(comments are locked)
|

How would you identify these objects? Do they have something in common? The same tag or parent would work, but I'd need to know before giving an useless answer :)
They are in groups of tags, i have aranged those groups of tags into parents. So all the ones with the same tags now have the same parent.