I’m afraid I have to agree…also, a huge mishmash of functions in a single script like that isn’t very useful, especially with a non-descriptive name like “X”. What’s with code like
static function MousePosition ()
{
return Input.mousePosition;
}
? Doesn’t serve any purpose. This is meant as constructive criticism, not bashing.
here can I say one thing, this is only a beta and there are still expected to be problems like this, also this only beta 1, thank you for your suggestion
yeah I know this was a bad idea from the start I should really just include the playerprefs things because those would be somewhat helpful .Setbool .GetBool soory but yeah I created this to serve no real purpose except to make it somewhat useful for my game Skway racer check out the website www.dreamerco.tk
Someone, please correct me if I am wrong but because I haven’t actually used PlayerPrefs yet… But having worked with .config files and similar in java and .NET, I really dislike reading/writing the values from external file freely anywhere in the code.
For one PlayerPrefs is stored into a file. Maybe each access does not read/write to the file but still does not seem to me a good idea to overuse this possibility…
So, I would see one way to do this would be to have a GameSettings class that is initialized at Game start and saved when player has changed and finally approved those settings.
Something like…
class MyGameSpecificSettings
{
var myGameSpecificString : String = "default";
var myGameSpecificBool : boolean = true; // default
var myGameSpecificInt : int = 1; // default
function MyGameSpecificSettings() // constructor
{
myGameSpecificString = PlayerPrefs.GetString("myGameSpecificString");
myGameSpecificBool = boolean.Parse(PlayerPrefs.GetString("myGameSpecificBool");
myGameSpecificInt = PlayerPrefs.GetInt("myGameSpecificInt");
}
function Save()
{
PlayerPrefs.SetString("myGameSpecificString", myGameSpecificString);
PlayerPrefs.SetString("myGameSpecificBool", myGameSpecificBool.ToString());
PlayerPrefs.SetInt("myGameSpecificInt", myGameSpecificInt);
}
}
When new player initially arrives you would do something like:
var settings : MyGameSpecificSettings = new MyGameSpecificSettings(); // Initializes default settings
Then somewhere for example in your game where player updates his ship you can do
And finally when user approves all the changes you would do:
settings.Save();
Unity is an excellent Game Development Tool. Create your Settings file and use it smartly then focus on the actual game mechanics of your game and Have Fun!
edit: Sorry, I did not compile and test this code, just wrote from top of my head. But I am sure you get the idea.