I am working on a project and I have a couple of scripts with variables that need often change for tweaking purposes. My question is this: how do I go about and display on screen the variables in a GUI? Where do I have to look for that, I am not sure how to search for this in documentation (hence this long question); On the same scripts in the Inspector tab I want to display images instead of text; This is just to replace a long list of items and make it nice for the developer. That coped with what's visible on screen I am hoping to create a nice education way of presenting various script setups.
To be able to display values in the game GUI and be able to change them is not very hard, here's an example (not tested)
This will display the values on screen. There is no good way to display numbers-only fields in the game gui though, so I used a slider in the example instead.
To display stuff in the editor is a bit more tricky (or at least not as common or well documented) But you can read on here to get started. Extending The Editor - Unity Reference Manual
Hope it will help you get started.
answered Dec 17 '10 at 01:49 PM
this is another example on how to display a variable.
public class exampleScript : MonoBehavior
what (int) does is typecasts myVariable to an integer, in other words it just drops the decimal point and doesn't round. I find type casting comes in handy when you need a float and integers wont work or visa versa.