- Home /
How do you save a seed?
If I generate a random level how do I save the seed itself. I'm trying to do it like, after it runs all the code to generate the level it gets the seed, then saves it to a variable. Then if the level is reloaded it will load that variable seed instead. Just as an example, it would run something like this, pseudocode obviously.
if(savedseed= false)
{
level generation stuff runs here
{
seed = savedseed
savedseed = true
}
}
if(savedseed = true)
{
Load seed.savedseed
}
Hope that makes sense. Just let me know if it doesn't.
Answer by PouletFrit · Jun 05, 2014 at 02:01 AM
Just as you would save pretty much anything else.
A few options:
Custom Serialization: Binary, XML, JSON, ...
Depends on your needs, but you could probly go with something as simple as Player Prefs since normally a seeds is just a number or a string.
Okay, I guess I just need to look into saving in general then. Not something I've done yet, I'll check out the links, thank you.
Your answer
Follow this Question
Related Questions
2D Tile Map Question 0 Answers
Having trouble with PlayerPrefs in my script. 1 Answer
Random Tile Generation 0 Answers
Generate minecraft alike terrain 0 Answers