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 Kantus · Jan 27, 2015 at 08:18 PM · c#graphicscounterammo

2D GUI Boxes/Labels not visible

Hi all,

For the moment I'm sticking with Unity 4.3, and so I'm still using GUI labels, boxes, et al rather than the Canvas system. My problem is this - I've got a GameObject in my Inspector, called GUI, with a child called AmmoCounter. This Label is meant to render a little box in the corner that shows how much ammunition remains for a player's weapon. For the time being, I'm focussing on just getting the GUI to render in the first place. As such, I attached the following script to AmmoCounter:

 using UnityEngine;
 using System.Collections;
 
 public class ammoCounterGUI : MonoBehaviour {
 
     void onGUI(){
         GUI.Box (new Rect (0, Screen.height-50, 100, 50), "Test");    }
 }
 

(I also tried a version with GUI.Label, which was just as ineffective).

But when I loaded my game, no box of any kind was visible. Now, I suspect that there might be something along the lines of the GUI element being present, but not visible here, such as if it were being rendered behind the background or off the side of the screen. And yet, I'm fairly convinced that, given the coordinates used, the box should be visible. Is there something I'm missing here?

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
Best Answer

Answer by pako · Jan 27, 2015 at 08:31 PM

You should correct your spelling: Use OnGUI not onGUI.

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 Kantus · Jan 28, 2015 at 09:24 AM 0
Share

It worked, thanks. $$anonymous$$akes me feel rather silly, but we all have those moments when we're so convinced that we're doing it right that we can't see the misspelling we made, don't we? :p

avatar image pako · Jan 28, 2015 at 11:03 AM 0
Share

Don't worry, this is a very-very common mistake.

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

Distribute terrain in zones 3 Answers

Smoothing Directionally between three materials 1 Answer

How to use Matrix4x4? 2 Answers

Dropdown menus for settings have randomly stopped working 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