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 SupremeShad18 · Jan 24, 2014 at 09:33 PM · error

Help Solve This

Please help solve this script error it keeps saying unexpected symbol { but I dont see anything wrong. Its a simple texture button script.

using UnityEngine; using System.Collections;

public class GUIButton : MonoBehaviour {

 public Texture2D texture = null;

 private void OnGUI(){

     if(GUI.Button(new Rect(Screen.width/2 -63,Screen.height/2 -63,texture.width, texture)){

         Application.LoadLevel(1);

     }
 }

}

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

2 Replies

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

Answer by roojerry · Jan 24, 2014 at 09:40 PM

missing a )

 if(GUI.Button(new Rect(Screen.width/2 -63,Screen.height/2 -63,texture.width, texture))){
Comment
Add comment · Show 5 · 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 SupremeShad18 · Jan 24, 2014 at 09:43 PM 0
Share

Thanks I was going crazy for a $$anonymous$$ute lol

avatar image roojerry · Jan 24, 2014 at 09:45 PM 0
Share

No Problem. $$anonymous$$ark this as the correct answer to close this question please

avatar image SupremeShad18 · Jan 24, 2014 at 09:50 PM 0
Share

didnt work now it says Overload method match for Rect(screen etc.

avatar image roojerry · Jan 24, 2014 at 09:52 PM 0
Share

You should be sending 4 floats as arguments to new Rect. Check the last argument. I assume you meant texture.height

avatar image Dan Deibler · Jan 24, 2014 at 09:56 PM 0
Share

Your last argument isn't of a type that can be implicitly converted to a float. You probably meant to use texture.height ins$$anonymous$$d of just texture. if(GUI.Button(new Rect(Screen.width/2 -63,Screen.height/2 -63,texture.width, texture.height))){

avatar image
0

Answer by Dan Deibler · Jan 24, 2014 at 09:43 PM

You're missing a closing parenthesis on line 5. You have 3 opening but only 2 closing.

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 Dan Deibler · Jan 24, 2014 at 09:48 PM 0
Share

"edited 10 $$anonymous$$utes ago" "answered 3 $$anonymous$$utes ago" It's going to take me some time to adjust to the unique temporal mechanics of this place.

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

20 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

Related Questions

Multiple Cars not working 1 Answer

Script error help! 1 Answer

Scripting error #2! 2 Answers

what is wrong with this online FPS script(not done) ? 1 Answer

GUI cale and position according to the actual screen resolution. 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