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 XienDev · Dec 22, 2012 at 09:36 AM · guitexturefadedepth

GUI.DrawTexture over screen

Hi guys, i want to create fading effect before game'd started. My steps are:

 initialize texture:
 
 1)     private Texture2D    m_texture;
         ..................................
         m_texture = new Texture2D(1, 1);    
  
 Apply Color to texture:
 
 2)      m_texture.SetPixel(0, 0, new Color(0, 0, 0, alpha));
         m_texture.Apply();
 
 Draw texture:
 
 3)      GUI.depth = 0;
         GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height),  m_texture, ScaleMode.StretchToFill);    
 
     
 For all others components and windows i've setted GUI.depth  greater than 0 (1...n)
 
 But one gui window whatever draws over this texture...
 
 Any idea ? 
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

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by XienDev · Dec 22, 2012 at 10:23 AM

hm... i'm posting problematic windows and fading texture:

 ------------------------
 Window OnGui
 Fade OnGui
 Fade OnGui
 Window OnGui
 ------------------------
 Window OnGui
 Fade OnGui
 Fade OnGui
 Window OnGui
 ------------------------
 

thanx to all who looked here...

I found an answer:

1) be sure that u setting GUI.depth for any class presenting on a scene gameobjects does not have the same value

2) be sure tha gui.depth u need is always less then all others

3) gui depth are only works with different scripts (like script execution order at runtime and gui)

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 Catlard · Dec 22, 2012 at 10:13 AM

Is it possible the troublesome GUI draw call that you're talking about is happening AFTER your fade texture is being updated? What order are you drawing the GUI textures in?

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

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

10 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

Related Questions

Gui appear and then fade to black 1 Answer

Repeat fade in and out 1 Answer

Making a GUI texture fade in and out depending on player proximity with enemy 2 Answers

How to make a GUITexture fade In? 1 Answer

rotating GUI texture by angle 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