|
I'm trying to use GUI.DrawTexture to create a custom progress bar type object within OnInspectorGUI. Despite the fact that I haven't been able to get it to work outside of OnGUI, I also haven't had luck creating what I want. Basically, I have two sliders that control the range you select. The first would select the opening value of the range, and the second selects the end value. There would then be a texture drawn in between the two that updates with the sliders as you move them. Outside of the range, the texture would be different on each end. Currently, I only have a custom progress bar that fills in from one side working, based on answers from other questions. Is a selector like this possible to create with Unity's API? Here's my code so far: The sliders are in a different script within the Inspector.
(comments are locked)
|
|
To do this, I ended up using EditorGUI.DrawPreviewTexture instead of GUI.DrawTexture. I also used a MinMaxSlider from EditorGUILayout to specify a time range. DrawPreviewTexture draws a dynamic color bar underneath to show where previous time ranges were saved (reading from XML). Since DrawPreviewTexture requires a texture to show, I just initialize my own color textures based on how many time ranges I have with the following function:
(comments are locked)
|
