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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
1
Question by Nk.Andrei · Aug 29, 2012 at 06:06 PM · guilabelnotdoes

GUI Label does not appear on screen.

I am currently trying to make a timer appear on screen by using the GUI Label but it does not appear and there arent any errors that I know of.I tried changing the values from 10 to 300 to 5000 and negative bu still does not appear.

GUI.Label(Rect(10,10,100,30),"Time:" +gameTime);

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

4 Replies

· Add your reply
  • Sort: 
avatar image
5

Answer by Piflik · Aug 29, 2012 at 06:14 PM

Where did you put this code?

GUI stuff should be in OnGUI().

Example:

 function OnGUI() {
     GUI.Label(Rect(10,10,100,30),"Time:" +gameTime);
 }
Comment
Add comment · Show 2 · 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 keinabel · Mar 31, 2013 at 03:02 PM 0
Share

I have a similar problem. I display a GUI Button. When clicked the label should appear. Button is displayed, Label not.

avatar image ThomLaurent keinabel · Jan 19, 2017 at 08:58 PM 0
Share

$$anonymous$$e too... in 2017 (Unity 5.3.5) It appears EditorGUILayout.LabelField() works better.

avatar image
3

Answer by commawht · Nov 19, 2012 at 08:13 AM

aand the problem i had was "OnGUI" i had written "onGUI" - lower case first letter instead of upper case. stupid i know .. but it took me 15 mins to find out the pbm

Comment
Add comment · Show 2 · 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 rjjatson · Jun 08, 2014 at 04:05 AM 0
Share

same problem here, and i did it twice.

avatar image GR1EF0R · Jun 20, 2017 at 12:02 PM 0
Share

Can confirm, this was exactly my mistake. Thanks for the tip.

avatar image
1

Answer by Tyche10 · Apr 13, 2017 at 03:37 PM

Since I cannot comment, I will reply: I had the same problem. With me it was caused by the scale slider above the game view in the editor not being set to 1x

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

Answer by MaxRCG · Sep 27, 2017 at 06:45 AM

@Piflik i dont understand the problem here, it should display an asterisk in the centre as an aiming rectile, but it doesnt

private Camera _camera; void Start () { _camera = GetComponent ();

         Cursor.lockState = CursorLockMode.Locked;
         Cursor.visible = false;
     }
 
     void OnGUI() {
         int size = 12;
         float posX = _camera.pixelWidth/2 - size/4;
         float posY = _camera.pixelWidth/2 - size/2;
         GUI.Label (new Rect (posX, posY, size, size), "*");
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 bsivko · Jan 24, 2018 at 10:31 PM 0
Share

You use "_camera.pixelWidth" two times. The second one should be _camera.pixelHeight.

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

17 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

Related Questions

GUI.label overlapping text 1 Answer

Dynamic Resizing of tooltip to match content? 1 Answer

(GUI.Label) Line spacing issue with wordwrap 0 Answers

Making a text box appear after a certain gameObject is destroyed 0 Answers

GUI Destroy Label? 3 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