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 Max Designer · Jan 13, 2013 at 04:40 AM · c#monodevelop

What's wrong with my script?

I wrote my first enter code here C# script and i am giving errors, is it correct?

 using UnityEngine;
 using System.Collections;
 
 public class HelpOptions : MonoBehaviour
 {
 public bool modesButton;
 public bool controlsButton;
 public bool goalButton;
 public bool optionsButton;
 public bool aboutButton;
 public bool storyModeButton;
 public bool survivalModeButton;
 public bool challegeModeButton;
 public bool questModeButton;
 
 void OnMouseEnter() 
 
 {
   renderer.material.color = Color.blue;
   transform.localScale += Vector3(0.0009,0.0009,0);
 }
 
 void OnMouseExit() 
 
 {
   renderer.material.color = Color.white;
   transform.localScale += Vector3(-0.0009,-0.0009,0);
 }
 
 void OnMouseUp() 
 {
     if(modesButton)
     {
     Application.LoadLevel(11);
     
     else if(controlsButton)
     {
     Application.LoadLevel(12);
     }
     
       else if(goalButton)
       {;
     Application.LoadLevel(13);
     }
     
       else if(optionsButton)
     {
     Application.LoadLevel(14);
        }
        
     else if(aboutButton)
     {
     Application.LoadLevel(15);
     }
     
         else if(survivalModeButton)
     {
     Application.LoadLevel(8);
     }
     
       else if(challegeModeButton)
       {;
     Application.LoadLevel(9);
     }
     
       else if(questModeButton)
     {
     Application.LoadLevel(10);
        }
     else if(storyModeButton)
     {
     Application.LoadLevel(7);
Comment
Add comment · Show 5
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 Lovrenc · Jan 13, 2013 at 04:53 AM 0
Share

User format code button to format your code. This is unreadable.

avatar image Loius · Jan 13, 2013 at 05:03 AM 0
Share

The errors tell you what line has a problem.

avatar image Max Designer · Jan 13, 2013 at 06:05 PM 0
Share

36 and 72.

avatar image Lovrenc · Jan 13, 2013 at 06:08 PM 0
Share

And we should now count the lines!? Not to mention your formatting might be different than it is in this post.

Copy the lines and paste them here...

avatar image Max Designer · Jan 13, 2013 at 06:13 PM 0
Share

it's the first "else if" and the last line of command "Application.LoadLevel(7);"

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by geniuscd · Jan 13, 2013 at 01:09 PM

do u have a collider on ur prefab/GameObject? check if the script is attached to the prefab/GameObject

OnMouseEnter(), OnMouseUp() needs collider in order to work when you click on them in the Game.

Comment
Add comment · Show 1 · 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 Max Designer · Jan 13, 2013 at 05:57 PM 0
Share

Yes, i do have collider on them.

avatar image
0

Answer by Wolfram · Jan 13, 2013 at 06:21 PM

Before that "else" there is a "}" missing. At the end of your script there are two "}" missing.

Comment
Add comment · Show 13 · 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 Max Designer · Jan 13, 2013 at 06:27 PM 0
Share

it fix the first one with the else but the last one is still there and yes i added the "}"

avatar image Wolfram · Jan 13, 2013 at 06:28 PM 0
Share

Did you add two? Don't you think it would help if you told us what the error actually says?

avatar image Wolfram · Jan 13, 2013 at 06:29 PM 0
Share

O$$anonymous$$, make that three "}", the class is missing its closing bracket, too.

avatar image Max Designer · Jan 13, 2013 at 06:31 PM 0
Share

(laughing) oh sorry, yes i did add two and the error says "Assets/Scripts/HelpOptions.cs(75,1): error CS8025: Parsing error"

avatar image Lovrenc · Jan 13, 2013 at 06:48 PM 2
Share

Because compiler now actually had a change to compile somewhat correctly and found other shit you did wrong.

Show more comments

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

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

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

panel hide and show in NGUI 1 Answer

Unity isn't properly syncing with project 0 Answers

Equality and Inequality operators not found in DLL ??? 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