- Home /
Anybody have any idea about
Any body have any idea about How we can access this thing using script
When you bring up the lightmap tab, you should get a little window in the bottom right of the scene view. Just untick "Use Lightmaps".
I am trying to do this from long time but unable to do it.
I cant swith lightmaps because lightmaps are very heavy in its size and the game stucks if I try it .
During gameplay,Using script I want to access use lightmap property.
Answer by svenskefan · Dec 10, 2012 at 12:56 PM
Thanks a lot . but I was not able to use it can you please give me a small example.
Answer by Pix10 · Dec 23, 2012 at 07:26 PM
You need to change the .lightmapIndex property of every object's renderer (every object that is lightmapped).
You can find out if an object it lightmapped by querying the renderer, i.e.:
Debug.Log(gameObject.renderer.lightmapIndex);
A result of 0 means the object is using the first lightmap. 1 means it's using the second, and so on.
The docs link svenskefan posted further explains the results, with the exception of:
also means no lightmap (the docs say 255 is the same, but I've never seen this).
Be aware that if you have multiple lightmaps and you want toggle them On/Off then you need to keep a record of what each lightmapped objects lightmapIndex is before setting it to i.e. -1 to turn it off.
As I mentioned in the previous comment "Can you please post A example script here I am not able to use this lightmapIndex property"
Your answer
Follow this Question
Related Questions
Missing lightmap when start play mode 0 Answers
Can't edit lightmaps. 0 Answers
What method exactly can be used to achieve lighting like this? (2d platformer) 0 Answers
Lightmapping doesn't work 1 Answer
Is there anyway to disable the packing and atlassing process during the lightmapping process? 0 Answers