Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by anilgautam · Dec 10, 2012 at 11:09 AM · lightinglightmappinglightmaps

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.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by svenskefan · Dec 10, 2012 at 12:56 PM

http://docs.unity3d.com/Documentation/ScriptReference/Renderer-lightmapIndex.html?from=LightmapData

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image anilgautam · Dec 10, 2012 at 01:18 PM 0
Share

Thanks a lot . but I was not able to use it can you please give me a small example.

avatar image
0

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.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image anilgautam · Dec 24, 2012 at 04:35 AM 0
Share

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

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges