Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by ThatOneGuyReally · Aug 10, 2016 at 10:24 PM · javascriptscripting problemerrorpragma

Script error, cannot fix whatsoever!

Hi there, I asked a question earlier today about browsers and working in a game, but I received an answer! (Thanks to the guy who helped a lot!~) But I have an issue with it. It gives me an error that I cannot fix. And when I do, it just gives me the same error. If somebody can help, it's a life saver!

 switch (inputField.text.ToLower())
 {
     case "www.blahblah.saq":
         // do something when they hit up www.blahblah.saq
        break;
     case "www.microsoft.com":
         // do something else based off the www.microsoft.com URL
         break;
     default:
           // load up the browser image for any "WRONG" URL's
  
 }


It gives me this error, alt text

capture.png (3.0 kB)
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
0

Answer by SarperS · Aug 11, 2016 at 01:46 AM

You forgot a break after the default case.

 default:
     break;
Comment
Add comment · Show 7 · 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 ThatOneGuyReally · Aug 11, 2016 at 02:35 AM 0
Share

alt text

Alright, It gives me that error, which I can fix! And I did. But then it just keeps giving me the error "Unexpected token . "

Which nothing seems to be there. Ah', Unity is absolutely weird when it comes to scripting.

capture.png (18.9 kB)
avatar image SarperS ThatOneGuyReally · Aug 11, 2016 at 02:38 AM 1
Share

You've added 2 break statements after the first case. There should be one. And you are still missing a break statement after the default case.

avatar image SarperS SarperS · Aug 11, 2016 at 03:03 AM 1
Share

I've already commented the corrected version of your original code block.

Show more comments
avatar image ThatOneGuyReally · Aug 11, 2016 at 03:05 AM 0
Share

I saw, apparently it didn't send until after, sorry bout' that! D: Let me check sir, sorry..~

avatar image ThatOneGuyReally · Aug 11, 2016 at 03:07 AM 0
Share

Alright, got it! Dude, you have no idea how much this has been stumping me, thank you so much! :D

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

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

Related Questions

Getting error on lap counter script JS 0 Answers

ScriptingProblems - Open door with 3 keys 1 Answer

Enemy AI for Shooting Game 1 Answer

Translate C# into Javascript 0 Answers

Why do I keep getting this error? 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