Inspector slider value?

Shader variables that represent range (e.g. Range(0.5, 1.3)) can be set in the Inspector using a slider. The problem is - the slider doesn’t show the actual value (given by a number) anywhere. I’ve set the shader variables in the Inspector so that my model looks nice but now I need to know what exact values the variables have so I can use them in code.

How the hell do I retrieve the exact values from variable sliders?

Look at this screen:


How do I know what exact values do Shininess and Grad have?

You can switch the Inspector to the “Debug” view. All visible float properties of the shader will then be listed in the SavedProperties->Floats array, by property name and current value. You can use the same trick to set these properties to explicit values via the Inspector interface (as opposed to a script).

Here is a quick editor script as an example. Put it in the Editor folder of your project. Pick the ‘ShowSliderValues’ from the Window menu. You have to hard code the property that you are interested in. Fortunately shaders tend to use the same property names:

using UnityEngine;
using UnityEditor;
using System.Collections.Generic;

public class ShowSliderProps : EditorWindow {

	public static void ShowWindow() {

	Transform curr;

	void OnGUI() {
		curr = Selection.activeTransform;

		GUILayout.Label("Shininess: "+GetSlideProp("_Shininess"));
	float GetSlideProp(string prop) {

		if (curr == null) {
			return -1.0f;

		Renderer rend = curr.GetComponent<Renderer>();
		if (rend == null) {
			return -1.0f;

		if (!rend.material.HasProperty(prop)) {
		    return -1.0f;

		return rend.material.GetFloat(prop);

Note that if you are playing with the slider, you need to change the focus to the window this editor script brings up in order to see the changed value.