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 Mike B · May 28, 2014 at 09:46 PM · identifierunknown

unknown identifier

i have a script, that is a component to a light switch model, to turn lights on and off. i have a class set up as a list to allow multiple lights to be paired. The sample script is here:

 import System.Collections.Generic;
  
 var lights : List.<Lightsoi> = List.<Lightsoi>();
 var Material1 : Material;
 var Material2 : Material;
 
 var switchoi : GameObject;
 
 public class Lightsoi {
     var shine : Light;
 }
 
 function Update() 
 {
         var fwd = transform.TransformDirection (Vector3.forward);
         if (Physics.Raycast (transform.position, fwd, 10)) 
         {
             var mat : boolean = false;
             mat = !mat;
             if(mat)
             switchoi.renderer.material = Material1;
             if(!mat)
             switchoi.renderer.material = Material2;
             if(Input.GetButtonDown("interact"))
             {
             var on : boolean = false;
             on = !on;
             if(on)
             shine.enabled = true;
             if(!on)
             shine.enabled = false;
             }
         }
 }

shine is the light variable, and on lines 29, and 31, i get an error saying

Assets/Standard Assets/Scripts/General Scripts/Switches.js(29,25): BCE0005: Unknown identifier: 'shine'.

and

Assets/Standard Assets/Scripts/General Scripts/Switches.js(31,25): BCE0005: Unknown identifier: 'shine'.

can someone tell me how to fix this?

Comment
Add comment · Show 2
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 rutter · May 28, 2014 at 09:47 PM 0
Share

This bit:

 public class Lightsoi {
     var shine : Light;
 }

You're declaring a tiny, one-variable class which doesn't appear to be used. The variable "shine" isn't in scope because it's in that tiny class.

You probably want "shine" to exist in your outer scope. Get rid of the class. It should just look like this:

 var shine : Light;
avatar image tw1st3d · May 28, 2014 at 09:55 PM 0
Share

Or,

 lights.Add(new Lightsoi());
 //and call using
 lights[0].shine

0 Replies

· Add your reply
  • Sort: 

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

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

Related Questions

BCE0005: Unknown identifier: 'transform' 2 Answers

HealthPack Script Problem... 1 Answer

Error BCE0005: Unknown identifier: 'GetAxis'. 0 Answers

Error BCE0005: Unknown identifier: 'GetAxis'. 0 Answers

how to fix unknown identifier? 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