x


Programatically update serialized script variable

I need to get my application's version during runtime (Though this question would be useful for many other things as well).

This is possible in the Unity editor using PlayerSettings.bundleVersion, but the PlayerSettings library isn't available outside of the editor.

How do I update the default value of a variable serialized to a script while that script is running in the editor? (I can of course update that variable by hand in the inspector while the game isn't playing, but I love automating things to reduce the possibility of human error).

more ▼

asked Jun 21 '11 at 04:49 PM

Aubrey Falconer gravatar image

Aubrey Falconer
672 46 54 68

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

1 answer: sort oldest
more ▼

answered Jun 21 '11 at 04:56 PM

ckfinite gravatar image

ckfinite
1.3k 5 9 24

Thanks! SerializedProperty.stringValue looks like what I need.

Jun 21 '11 at 05:03 PM Aubrey Falconer
(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:

x5271
x849
x189
x17

asked: Jun 21 '11 at 04:49 PM

Seen: 950 times

Last Updated: Jun 21 '11 at 05:03 PM