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 Saint34x · Mar 12, 2013 at 10:09 PM · texturesgui buttons

GUI button's disappearing behind full screen Texture

hey guy and gals! im working on a main menu screen. pretty simple, i have a full screen texture script and a load level script but heres the rub, when i play the game the GUI button textures appear behind the full screen texture. now if i unclick the check box by the full screen texture script i can see the buttons and if i click it again the buttons appear correctly above the full screen texture. i've tried rebuilding the scene a couple of times and heres the weird part, at first it will all display correctly then it'll go back to being hidden.

 photo ScreenShot2013-03-12at43928PM_zps234c667e.png

 photo ScreenShot2013-03-12at43945PM_zps010e5a1c.png

 photo ScreenShot2013-03-12at43958PM_zps409da510.png

i thought maybe it was an order issue kinda like layers over lapping in photoshop but i've moved them into different orders and i get the same issue. both the scripts are applied to a empty Gameobject.

below are the two scripts im using in case its a scripting error.

here is the script for my load level button

 var levelToLoad:String;
 var graphic = TextureGUI(); //(28,23);
 var startPoint = Location();
 var GUIColor:Color = Color.white;
 var noGuiStyle : GUIStyle;
 
 function Start() {
     graphic.setAnchor();
 }
 
 function Update() {
     if (graphic.texture){
         startPoint.updateLocation();
     }
 }
 
 function OnGUI() {
     GUI.color = GUIColor;
     if (GUI.Button(Rect(graphic.offset.x+startPoint.offset.x,graphic.offset.y+startPoint.offset.y,graphic.texture.width,graphic.texture.height),graphic.texture,noGuiStyle)) {
         Application.LoadLevel("test_tunnel");                    
     }            
 }

and here is the display full screen script

 @script ExecuteInEditMode()
 var graphic = TextureGUI(); //(28,23);
 var GUIColor:Color;
 
 function OnGUI() {
     GUI.color = GUIColor;
     if (graphic.texture) {
         GUI.DrawTexture(Rect(graphic.offset.x,graphic.offset.y,
                         Screen.width,Screen.height),
                         graphic.texture,ScaleMode.StretchToFill,true);
     }
 }
 
 function AlphaUp(change:float) {
     GUIColor.a += change;
 }
 
 function setStartColor(color:Color) {
     GUIColor = color;
 }
 
 
 function setDelay(delay:float) {
     if (GUIColor.a > .5) {
         GUIColor.a += delay;
     } else {
         GUIColor.a -= delay;
     }
 }
 
 function AlphaDown(change:float) {
     GUIColor.a -= change;
 }


thanks for any help you guys can give me!

-Mike

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 Seth-Bergman · Mar 12, 2013 at 10:16 PM

for this simply use GUI.depth

just add :

 GUI.depth = -1;

to the button script (inside the GUI function), problem solved!

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 Saint34x · Mar 12, 2013 at 11:04 PM 0
Share

you sir are a genius! it now works like a charm! thanks for the quick response time as well!

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

11 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

Related Questions

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

Is it possible to automate material creation with new textures? 2 Answers

How do i make a mirror? 2 Answers

How to import the object from server to unity 2 Answers

Help?! Changing Textures via mouse click 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