slider controller in inspector using custom c# script.

I could be wrong, but it seems like slider controller is not doable using c# script in the inspector window…?

I saw some js script that does this ( like the ones in the post processing script ) but even there , I could not figure out what makes some float value to include its own slider controller and some not.

I know you can do this in custom editor window, but I want it to be just straight foward on the inspector window where my script component shows. This is possible for custom shader, so why not for c# and is this possibility at all?

cheers.:slight_smile:

Sliders work for me in the inspector. As far as I know, all the editor scripts from Unity are implemented in C#. I don’t see a reason why anything that can be done in JavaScript can not be made with C#.
Usually, if something works in a custom editor window, it should also work in the inspector.

It would help, if you could share some code of things that are not working for you.

Well, for example

if I define,

public float value;

in my script, then I can see it is exposed as a single float input without slider in the inspector where my script component lies.

but I can’t seem to figure my way out on how to enable slider bar controller along side of the float input in the same area.

Do you have example code that I can see that works in the inspector window?

Are you aware of this documentation page?

The only thing you need to do with it is to translate it to C#. But there are lots of other examples that you may use as a starting point, such as that one.

before u declare ur float in your script add the [Range(min,max)]

example

[Range(0.2f,5.0f)]
public float x1;

hope that works

Cheers will try that!

Just answering to confirm what Nagual.George suggests WORKS!

Keep in mind though that in Javascript its @Range(0.2f,5.0f)