• 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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
-1
Question by CYVISUALEFFECTS · May 14, 2013 at 12:59 PM · errorjava

Why do I get unexpected char error?

I get unexpected char BCE0044 "o"

 var hit6 : RaycastHit;
 if (Physics.Raycast(transform.position, transform.forward, hit6, 3)) {
     if ((hit6.collider.gameObject.tag == "Door") && (Door.oldGateState == oldGateStates.locked) )
         if(gotKey){
         Door 1.Open();
     }
 }
Comment
Add comment · Show 8
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 CYVISUALEFFECTS · May 14, 2013 at 01:29 PM 0
Share

Now I get 3 errors, and line 5 is to set the door as open in another sript, I think..

avatar image KiraSensei · May 14, 2013 at 01:34 PM 0
Share

Show us the errors, we can't help you without them. Where did you get this code (I suppose you didn't code it yourself if you say that :) )

avatar image CYVISUALEFFECTS · May 14, 2013 at 01:42 PM 0
Share

After putting your code, I get:"Uknown Identifier" for "Door" "got$$anonymous$$ey" and "Door1"

avatar image KiraSensei · May 14, 2013 at 01:45 PM 0
Share

I just copied your code, you should know what are these variable.

In my opinion, they are public variables in the script and they need to be filled with a game object in the inspector or defined before the block of code you gave us...

avatar image CYVISUALEFFECTS · May 14, 2013 at 01:49 PM 0
Share

Oh, the (Door.oldGateState, should be Door1. Fixed it. No errors now..

avatar image KiraSensei · May 14, 2013 at 01:51 PM 0
Share

So everything is good ?

avatar image CYVISUALEFFECTS · May 14, 2013 at 01:56 PM 0
Share

Yup. All's fine:)

avatar image KiraSensei · May 14, 2013 at 01:57 PM 0
Share

So I change my comment as an answer, please accept it.

1 Reply

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

Answer by KiraSensei · May 14, 2013 at 01:00 PM

What is the line 5 for ?

Door 1.Open(); contains a space char, is it normal ?

 var hit6 : RaycastHit;
 if (Physics.Raycast(transform.position, transform.forward, hit6, 3)) {
     if ((hit6.collider.gameObject.tag == "Door") && (Door1.oldGateState == oldGateStates.locked) ) {
         if(gotKey){
             Door1.Open();
         }
     }
 }

I added brakets to the second "if" statement.

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

14 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

Related Questions

Failed to recompile android resource files. 1 Answer

Unable to convert classes to dex format GoogleMobileAds SDK conflicting Facebook SDK 0 Answers

DexArchiveMergerException: Unable to merge dex 4 Answers

SCRIPT NOT WORKING 2 Answers

Gun Script Error (Fixed!!!) 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