Concept!Will it work?

Ok guys!Today a concept hit me.In one of my games i want to make it so the players can edit the physics of the big rig,save the physics set-up,then open the game and play the game with their physics set-up.

How i was gonna do this is create a separate program witch has a big rig,a bunch of sliders to change the physics,and a test track.Now all that is simple!I can do it.Only question i have is when they hit save how will i get that to edit the physics script throughout the game?

After some reading around the forum it seems its as simple as calling an Apply() to the script.And instead of making the save button overwrite the existing script in the game it would make a new script file else where and the current code in the game would look for that script,if its found it uses it,if it isnt then use existing physics.If someone could shed some light on this for me it would be wonderful.I kinda have an idea of how to do this but the idea isn’t strong enough for me to just go in full force and do it.

Ive never worked with editing scripts and saving them!I can edit a script in-game with a gui slider,but saving it might be a different story

As far as I can tell, this would be done simply by saving the values of specific variables associated with a script/component, and then when loading those settings, writing those values back to said variables. (As for ‘editing scripts’, I don’t really know what you mean by that.)

Well maybe not editing scripts exactly but just making it so when they save the physics file.The game will then use that file and those settings.

For saving and loading, you could use PlayerPrefs, or save and load manually using text files (or whatever format you prefer).

The rest is just reading values from and writing them to variables in scripts, so it seems like the only (potentially) tricky part is the saving and loading. If that’s hanging you up, perhaps you could explain in more detail what you’re having trouble with.

Also, the topic of saving and loading games has been discussed a lot here and on Unity Answers. Since this is a similar problem, you could probably find some useful references by searching for e.g. ‘save game’ or ‘save load game’.

Ah alright.Well i havent put the idea to work just yet so i dont have problems at the moment.But when i start doing it i will probably be contacting the forum.