• 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 MoPMetallica · Aug 06, 2012 at 10:56 AM · lightstorch

We're having trouble with our torch turning on and off all lights

Me and a mate are making our own game and we've got a torch for the player and lamps spread across the map. We're having trouble when we turn the torch on and off because when we turn the torch on, all the lamps in the map turn off and vice versa. How can we fix this?

Comment
Add comment · Show 7
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 fafase · Aug 06, 2012 at 10:57 AM 1
Share

We need to see codes. Right now we can only say that maybe you are using FindObjectsWithTag and all torches have the same tag. But how would I know...?

avatar image DESTRUKTORR · Aug 06, 2012 at 04:19 PM 0
Share

fafase is right. You need to post the code, or we won't know what you might have done wrong.

avatar image Eric5h5 · Aug 06, 2012 at 06:02 PM 1
Share

It's likely because you're using static variables, so don't do that.

avatar image MoPMetallica · Aug 07, 2012 at 01:37 PM 0
Share

I don't know if this is the right script and I can't get of my friend because he has the script and I wont be able to see him for a while but we're using the toggleLight.

avatar image Seth-Bergman · Aug 07, 2012 at 01:52 PM 0
Share

@Eric5h5 is right (as always)

wherever toggleLight is declared, it probably says something like:

static var toggleLight : boolean;

just remove the "static" keyword

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Screenhog · Aug 07, 2012 at 04:44 PM

Are you using the same material for the torch and the lamps? If so, are you editing the material directly to turn the torch on and off?

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

12 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 avatar image

Related Questions

How do I make a mesh visible only under a certain light? 3 Answers

Race begins when Green light shows 2 Answers

Blinking lights 3 Answers

Candelas values for Unity Lights 0 Answers

Dynamic Ambient Light 'Flicker' Effect | Example/Custom Images Inc. 2 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