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 Crucian · Oct 29, 2013 at 10:48 AM · guiguitexture

Create a Start screen using guitexture over the main menu

Hey guys I am having some problems with my main menu. I am trying to implement a guitexture that covers the screen and is over the main menu which will fade and become inactive if I click on it. However, my guiTexture is covered up by my buttons and the texture2d I used to render the background. I have tried changing the depth of the gui texture but it doesn't work. Here is my OnGUI code if you need it:

 GUI.DrawTexture(new Rect(0,0,originalWidth,originalHeight),Background);
         
 //CreateNew,Load and Quit are different GUI Styles.
         if(GUI.Button(new Rect(300,250,135,268),"",CreateNew) ){
                 Application.LoadLevel("New_Player");
         }
         //Load Player Button
         if(GUI.Button(new Rect(850,250,135,268),"",Load))
             Application.LoadLevel("Load_Player");
         
         
         if(GUI.Button(new Rect(600,600,200,100),"Delete")){
             PlayerPrefs.DeleteAll();
         }
         if(GUI.Button(new Rect(100,570,91,191),"",Quit)){
             Application.Quit();
         }
 

Is there a way such that i can choose the order in which the guiTexture is rendered? I would appreciate all the help I can get. Thanks a bunch!

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
1

Answer by fafase · Oct 29, 2013 at 10:52 AM

Because GUITexture are drawn before the OnGUI.

Anything OnGUI goes on top of the rest as being drawn last.

You have two solution though, either draw your covering texture inside the OnGUI with GUI.DrawTexture using the depth or Deactivate your OnGUI.

The first one is better as you get the texture covering the whole thing, the second one would remove the button and the start covering the screen.

Comment
Add comment · Show 4 · 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 Crucian · Oct 30, 2013 at 02:15 AM 0
Share

How do I use GUI.DrawTexture using depth? When i try use my guitexture in the GUI.DrawTexture function, it returns an error.

avatar image Josh707 · Oct 30, 2013 at 02:36 AM 0
Share

What's the error? You can just use a Texture or Texture2D I'm pretty sure. A very good example of menu fading that you're trying to do is available in this Receiver games source code repository:

https://github.com/$$anonymous$$20321/7DFPS/blob/master/UnityProject/Assets/splash_screen/splashscript.js

avatar image Crucian · Oct 30, 2013 at 06:31 AM 0
Share

The error basically means that the GUI.DrawTexture cannot take the GUITexture in as a parameter. Anyways managed to understand what to do with what Josh did. Thanks a bunch.

avatar image Josh707 · Oct 30, 2013 at 06:14 PM 0
Share

Cool! Glad I could help

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

16 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

Related Questions

Reduce Draw call for Multiple GUI Textures with same Texture 1 Answer

Activate GuiTexture When Clicking on BoxCollider c# 1 Answer

WorldToScreenPoint returns the same value when facing the opposite direction. 0 Answers

How to prevent guitexture from vertically shrinking? 0 Answers

Drawing UI text on GUI.DrawTexture , How to do it ? 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