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 ajohnson1910 · Mar 18, 2013 at 03:42 PM · gui-button

GUIButton won't appear Scripting problem, help?

 function OnGUI() {
 
 if (GUI.Button(new Rect(Screen.width - 100,Screen.height-35,350,50),"SoundCloud!")) { Application.OpenURL("https://soundcloud.com"); } 
 
 }

wheres the problem here??

Thanks!

Comment
Add comment · Show 6
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 BlackWingsCorp · Mar 18, 2013 at 03:56 PM 0
Share

What do you want the script to do exactly?

avatar image ajohnson1910 · Mar 18, 2013 at 04:30 PM 0
Share

didn't see this one, sorry for the lack of description, i've got a GUI button bottom left which opens facebook (browser version) and it fits perfectly, half way across the screen but when i try and create a button for the right hand side it doesn't show, there's no messages stating that the script is incorrect, so im guessing its positioning is out of the way but because i'm new at this im not entirely sure what the coordinates should be?

avatar image DeveshPandey · Mar 18, 2013 at 04:31 PM 0
Share

can i see the code, that you have written before this code? may b some error there...

avatar image ajohnson1910 · Mar 18, 2013 at 04:41 PM 0
Share

the code supplied in the original post is the original code

avatar image sdgd · Mar 19, 2013 at 08:48 AM 0
Share

can you format your code you have 010101 up there and afaik you need to have script on your camera

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by robertbu · Mar 18, 2013 at 03:54 PM

Your rect is just about off the screen. You can see a piece of your button in the lower right corner of the screen. Try this for your rect:

 Rect(Screen.width/2 - 100,Screen.height/2-35,350,50
Comment
Add comment · Show 3 · 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 ajohnson1910 · Mar 18, 2013 at 04:01 PM 0
Share

thanks for the reply robertbu but unfortunately that didn't work =[ i already have the following for another link (bottom left) and it works and fits perfectly.

function OnGUI() {

if (GUI.Button(new Rect(0,Screen.height - 100,350,100),"Facebook!")) { Application.OpenURL("https://www.facebook.com") ;}

}

avatar image robertbu · Mar 18, 2013 at 04:07 PM 1
Share

So you want it on the bottom right? Your Rect should be:

 Rect(Screen.width - 350,Screen.height-50,350,50);
avatar image ajohnson1910 · Mar 18, 2013 at 04:19 PM 0
Share

yeah sorry about that, i forgot to mention it, i did originally in the original post but then edited it and deleted it. and again unfortunately that didnt work, i cant even understand why...im testing on a Samsung GS3, to reiterate, left works as above ^ ^ but right doesnt =/

avatar image
0

Answer by ajohnson1910 · Mar 18, 2013 at 08:13 PM

I've tried moving the bottom-left to top-left...works perfectly but bottom-right to top-right...nothing! even when rotating the screen nothing shows up for the right hand button!

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 moghes · Mar 19, 2013 at 08:47 AM 0
Share

this answer better to be a comment

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

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

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Custom inspector size problem 1 Answer

How to create a gui button inside an if statement? 1 Answer

Remove GUI Buttons in Prime 31 Touch kit. 1 Answer

Question about script for minecraft-like terrain generation 2 Answers


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