Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by Bluestrike · Sep 08, 2011 at 12:28 PM · lights

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

Comment
Add comment · Show 4
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 Adam-Buckner ♦♦ · Sep 08, 2011 at 08:42 PM 0
Share

Bluestrike: the link you've posted leads to a 404: not found

$$anonymous$$ay I ask if you are trying to build an EDITOR script? And if so, what are you trying to automate?

avatar image Bluestrike · Sep 09, 2011 at 06:49 AM 0
Share

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.

avatar image Adam-Buckner ♦♦ · Sep 09, 2011 at 11:52 AM 0
Share

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.

avatar image Bluestrike · Sep 12, 2011 at 05:06 PM 0
Share

I have a streetlight prefab that players can drag into the scene. The prefab has a script where I assigned different materials, one for when the light is off, one when the light in on, and one if the light is on but set to dynamic in a editor script (no emmision) and its only used in the editor to let the artists see if the lamp is on/off at the start. There are also references to the meshes and spot or point lights. and its those spot and point lights the lightmode i want to control from another script, only in the editor, but not nessesarily in a editor scipt. (I have the prefab script run in the editor)

To hide away all these things that should not be messed with I made a editor script. In the editor script the artist has the choice to set the prefab on or off, and a light mode for the streetlight prefab. (lightmap only, lightmap-dynamic and dynamic) When the artist shooses the dynamic mode it means the light will be turned on and off ingame, esle he should use the other options, And when he chooses the dynamic mode, I need to set the light its lightmode to realtime only ins$$anonymous$$d of auto.

2 Replies

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

Answer by Bluestrike · Sep 15, 2011 at 06:14 PM

This bas been brought to my attention: http://answers.unity3d.com/questions/163585/how-can-i-access-lightmapping-settings-for-a-light.html

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

Comment
Add comment · 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
0

Answer by BerggreenDK · Sep 13, 2011 at 08:51 AM

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.

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 Bluestrike · Sep 13, 2011 at 05:54 PM 0
Share

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 ;)

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Turn off multiple lights trigger 1 Answer

How to switch off two lights? 2 Answers

How to import the object from server to unity 2 Answers

Can anyone help me figure this script out? (Light Trigger) 1 Answer


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