- Home /
How to create a custom inspector with percentage sliders like in LODGroup?
I want to know how to create custom sliders in inspector that sum a 100% value. Just like the Unity LODGroup inspector editor but instead of 200%, 100%.
No replies yet? I don't have an answer and I actually have your same question. Did you manage to figure out how to make a slider like that?
Pretty sure that is just a normal slider with a custom GUIStyle, you can set all those visual parameters in GUIStyles, and as far is the left being max and right being $$anonymous$$, you just switch use $$anonymous$$ as max and max as $$anonymous$$.
At some point I plan on making a GUIStyle creator editor extension, one probably exists though.
You're right, I'm starting to figure it out. Thanks! @RobAnthem
Answer by FM-Productions · May 25, 2017 at 09:25 AM
If the element selected is one of your own MonoBehaviour, in your MonoBehaviour class you can simply do this:
[SerializeField]
[Range(0.0f, 100.0f)]
public float sliderValue;
This will display a slider for you value sliderValue
that you can slide between the value 0 and 100