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 oopoe · Dec 04, 2012 at 02:56 AM · lightunexpectedbce0043token

Light Switching Unexpected Token Error

Hey guys I keep coming across this unexpected token error and it's doing my head in. A little help would be much appreciated.

I have two lampposts with pointlights each. tagged "Light1" and "Light2" respectively. I want Light1 to be off, but when the light intensity of Light2 becomes 0, which happens in a previous script, I want Light1 to tuen on with intensity of 2.2.

This is my script followed by my error.

 #pragma strict
 function Start () {
 
 }
 
 function Update () { //when lightoff2 script runs "light2" switches on
 
 var "Light2" light.intensity = 0;)
 
 if
 
 ("Light2" light.intensity == 0)
 
 ("Light1" light.intensity : float = 2.2);
 }
 }

Assets/Light2SwitchOn1.js(10,6): BCE0043: Unexpected token: Light2.

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Graham-Dunnett · Dec 04, 2012 at 02:51 PM

Sorry to break the bad news, but your script code is not even remotely correct. It's not valid Javascript. You don't declare variables in Javascript using the names of the lights in quotes. See:

http://docs.unity3d.com/Documentation/ScriptReference/index.Member_Variables_26_Global_Variables.html

for some help. Create two variables that you can assign your two lights to in the inspector. I am sure some kind soul here will give you more help.

Comment
Add comment · Show 2 · 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 Landern · Dec 04, 2012 at 02:59 PM 0
Share

Such a kind reply, you can have my vote.

avatar image oopoe · Dec 04, 2012 at 04:31 PM 0
Share

I have only started scripting in the last week so I have a long way to go. Thanks for your honesty and help.

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

unexpected Token error 1 Answer

Unexpected Token: if 2 Answers

How to change the intensity to go down over time and to go up after colliding with an object. 1 Answer

Rotate a camera when my flashlight is on the edge of the screen... Video included 2 Answers

Shader errors 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