Modifying sunshafts Distance falloff variable?


I’m currently trying to modify the distance falloff variable of the unity pro sunshafts script from another script.

Modifying the color and intensity works without problems, but it seems it is not possible to access the distance falloff variable. It’s also not defined as public variable in the sunshafts.js file, but it’s showing up in the inspector, how could that be?

Any idea how I can modify the value of that variable?


What are you trying to modify about it. The distance falloff is really an editor variable that modifies maxRadius. maxRadius was retrieved as a serialized field as a convenience for you.

If you look at SunShaftsEditor.js you will see:

maxRadius.floatValue = 1.0f - EditorGUILayout.Slider ("Distance falloff", 1.0f - maxRadius.floatValue, 0.1, 1.0);

This is where this value is set in the inspector, wrapped up in a little math.