Solution for swapping between lighting configurations easily

As a Roblox developer, it is currently a bit tedious to swap between different lighting configurations dynamically without either scripting each property, or manually setting each property in the Properties window.

If Roblox is able to address this issue, it would improve my development experience because it would allow me to do things such as quickly swapping between lighting setups for previewing, and quickly swapping lighting properties at runtime.

I think the best approach to this would be creating something like a LightingConfiguration class, which holds the same properties as the Lighting service.

From there, you could call Lighting:ApplyConfig(LightingConfiguration) to switch the properties of Lighting to those of the LightingConfiguration

image

Then, Lighting can be used as a store for different configurations, which can be swapped to easily.

13 Likes

You should title this thread after the problem (“Solution for swapping between different lighting configurations”) rather than a proposed solution (“Add a “LightingConfiguration” instance”). The latter will be harder for other people with the same problem to find in search / chime in on if they have a different proposed solution. Roblox may not implement this exactly as “LightingConfiguration”, so be clear about what you actually want.

ref from How to post a Feature Request

3 Likes

This would be better realized as a universal API for copying and storing properties for any instance into an instance that can be later applied to the same class (or perhaps any class with any matching property names). Give tweenservice an overload that accepts one of these and I will be very happy. My experience managing day-night cycle and ambience has been atrocious because I need to store a huge table of configuration for multiple different instances (lighting, atmosphere, color correction…), and to preview these settings I have to manually set all of the properties, or play the game and force the ambience to those properties. Tidy instances that can be one-click applied would simplify cases where I need to go back and tweak these settings so much.

Basically, exactly the same as Unity’s Preset asset. This would simplify a lot of tedium. Bonus points if I can index out each individual property so I can use it with my ambience blending system (e.g. rain+night, day+fog).

This would also be useful elsewhere with e.g. UI theming, I could let players switch UI between themes by simply applying presets to tagged UI elements instead of wrangling tables, or I could use this as a way to allow developers to easily store instance default settings that a plugin automatically applies.

This could also theoretically allow me to modify these properties using the properties panel, which is nicer than writing out property names and values in a table.

9 Likes

Got it. Thanks for being constructive.

2 Likes

That’s a great idea! I think I prefer it over what I proposed.

1 Like

Why not go further and say this should be achieved by scripts being able to access reflection data, get the complete list of properties on an Instance, and copy them into Attributes on a Configuration object? You could have a library setup the individual tweens, and use a plugin to apply the configuration in Studio.

5 Likes

Attributes do not support a few kinds of properties in a nice way (e.g. Enums, CFrames, Instances i.e. for SoundGroups on Sounds), but I do agree this idea would accomplish the same thing using API that is already built, which is very preferable. I have wanted to use reflection data for several other purposes too. If this is feasible to make available in-game as well as in-studio, this would be a much better solution.

4 Likes