Script acces to a light its lightmode?

How can I modify the Lightmapping setting of a light its lightmode (baked only, auto, relatime only) from a script?

The documentation is not listing that variable.

http://unity3d.com/support/documenta...nce/Light.html

Bluestrike: the link you've posted leads to a 404: not found May I ask if you are trying to build an EDITOR script? And if so, what are you trying to automate?

Its not a editor script, but I have one too and could do it from there as well. I have a lightpole prefab, in the editor the user can set it to on or off, switching between a self ilum material and a regular one, and changing the attached point light on and off as well. There is also a selection: lightmaps only, lightmap-dynamic or dynamic. Dynamic is used to make the light switch on and off ingame, so it is not supposed to generate light from the lightmapper and I will need to set the light its lighmappermode to realtime only in that case.

Can you tell me what your final goal is that you are trying to achieve? I think you are approaching this incorrectly. Lightmap settings should be (iirc and understand what you're asking) in edit time only. Tell us what you're trying to achieve and I'll try to tell you how to do it.

2 Answers

2

This bas been brought to my attention:

Now my question is if its possible to do this without using serilaizedObject.
But it appears to be the only way to have FindProperty() ?

My answer guessing from all the commenting + your question would be NO you cant. But you should be able to archive the same effect with another approach:

Make the different states as separate prefabs. One for each state. Then when the user configures it to be another type. You could make an “empty” Prefab with a parent axis and then instatiate/spawn the choosen type within it. If the player/user selects another type just destroy the child object and spawn the new type.

Yeah but the idea of my script is just to avoid having many prefabs, I have 19 prefabs already and if I have to make 3 of eatch state for those its going to be alot ;)