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 Liamh101 · Feb 17, 2013 at 04:47 PM · c#lightscritpingintensity

Changing light Intensity though script does nothing

I've written a script where when the player teleports a Particle effect turns on and a light turns on. To make the light turn on I decided to start the light with 0 intensity then when the script activates turn the intensity to 0.36.

The problem is that even though the object registers the input the light does not change (even though when I inspect the object the intensity = 0.36). I've posted the code bellow to make sure everything is correct, my guess that the lights are pre-rendered and so they cannot be changed during gameplay, however that's just my hypothesis and really have no idea.

Please could someone explain why my light is not changing and how I can fix this.

Thanks!

Code:

 using UnityEngine;
 using System.Collections;
 
 public class TeleportSectionComplete : MonoBehaviour 
 {
     public Transform exit;
     public Transform last;
     public GameObject lp;
     void OnTriggerEnter ( Collider other) 
     {
         if (exit == last)
             return;
         
         TeleportToExit( other );
     }
     
     void OnTriggerExit ()
     {
         Debug.Log("Exit Trigger");
         if (exit == last)
             last = null;
     }
     
     void TeleportToExit (Collider other)
     {
         last = transform;
         other.transform.position = exit.transform.position;
         lp.particleSystem.Play();
         lp.light.intensity = 0.36f; 
         
         
     }
     
 }
Comment
Add comment · Show 3
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 tuhinbhatt · Feb 17, 2013 at 04:53 PM 0
Share

Lights, are not pre-rendered and ofcourse they can changed in the gameplay.

avatar image Liamh101 · Feb 17, 2013 at 04:56 PM 0
Share

I've come straight from the Source Engine to Unity so it's taking me a while to adjust.

avatar image iwaldrop · Feb 17, 2013 at 07:11 PM 0
Share

What's more important here is the settings for the light. Since you've verified that the light'sintensity is changing, check the render mode for the light. It should be marked realtime and important.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by robertbu · Feb 17, 2013 at 07:46 PM

How many of these lights do you have? Look at Edit/Project Settings/Quality. Pixel Light Count will determine the maximum number that will be rendered.

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

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

Changing light colour makes it too bright 3 Answers

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

Interaction between Unity and Universal Windows 10 apps 0 Answers

Script flares onto lights? 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