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
3
Question by mattskate96 · Dec 11, 2011 at 01:42 AM · cameracolorfade

Fade Camera

Hey everyone, I'm looking for a simple way to make the main camera in the scene, to fade in from black. So basically, I press play, and the scene starts from a black screen, then 2 seconds after its back to the normal scene.

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
2

Answer by Aridez · Sep 05, 2016 at 04:26 PM

Here are some links that might actually help someone:

  1. Answer using OnGui

  2. Wiki article

  3. Another answer using OnGui

The method is quite similar on all of them, you want to draw a texture in front of the camera that gradually goes from being transparent to black.

Posted as a separate answer for visibility

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
2

Answer by toddisarockstar · Mar 30, 2017 at 02:14 AM

push the space bar....

     Texture2D blk;
     public bool fade;
     public float alph;
     void Start(){
         //make a tiny black texture
         blk = new Texture2D (1, 1);
         blk.SetPixel (0, 0, new Color(0,0,0,0));
         blk.Apply ();
     }
     // put it on your screen
     void OnGUI(){
         GUI.DrawTexture (new Rect(0, 0, Screen.width, Screen.height),blk);
     }
     
     void Update () {
         if(Input.GetKeyDown("space")){fade=!fade;}
         
         
         if (!fade) {
             if (alph > 0) {
                 alph -= Time.deltaTime * .2f;
                 if (alph < 0) {alph = 0f;}
                 blk.SetPixel (0, 0, new Color (0, 0, 0, alph));
                 blk.Apply ();
             }
         } 
         if (fade) {
             if (alph < 1) {
                 alph += Time.deltaTime * .2f;
                 if (alph > 1) {alph = 1f;}
                 blk.SetPixel (0, 0, new Color (0, 0, 0, alph));
                 blk.Apply ();
             }
         }
     }

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
1

Answer by luislodosm · Apr 01, 2017 at 11:31 AM

One way:

Create > UI > Image. Stretch to canvas.

 void FadeToBlack ()
 {
 blackScreen.color = Color.black;
 blackScreen.canvasRenderer.SetAlpha (0.0f)
 blackScreen.CrossFadeAlpha (1.0f, time, false);
 }
     
 void FadeFromBlack ()
 {
 blackScreen.color = Color.black;
 blackScreen.canvasRenderer.SetAlpha (1.0f)
 blackScreen.CrossFadeAlpha (0.0f, time, false);
 }
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 numeric1338 · Mar 16, 2018 at 11:39 PM 0
Share

What type is "blackScreen" ?

avatar image LilGames numeric1338 · May 11, 2018 at 07:18 PM 0
Share

It's an Image

avatar image
-3

Answer by Justin Warner · Dec 11, 2011 at 04:14 PM

http://answers.unity3d.com/questions/8540/how-to-fade-inout-a-scene.html

Please Google next time.

 https://www.google.com/search?rlz=1C1GGGE_enUS456US456&gcx=c&sourceid=chrome&ie=UTF-8&q=camera+fade+unity3d
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 infinitypbr · Feb 20, 2014 at 07:38 AM 0
Share

Haha -- I googled and found this answer :)

avatar image b33rdy · Sep 04, 2016 at 10:22 AM 0
Share

Googled. First hit. Poor answer.

avatar image Aridez · Sep 05, 2016 at 04:21 PM 1
Share

I hate when people do that, can an answer be more useless? At least you could google before posting.

Here are some links that might actually help someone:

  1. Answer using OnGui

  2. Wiki article

  3. Another answer using OnGui

The method is quite similar on all of them, you want to draw a texture in front of the camera that gradually goes from being transparent to black.

avatar image RedDjinnPro · Oct 05, 2017 at 10:46 PM 2
Share

I am only posting 7 years late on this because this kind of needless reply is still a problem today: In the future, it would help to remember that part of other people's googling experience is finding threads just like this where someone asked the community the question they need help with... that's the point of these forums.

@mattskate96, thanks for asking the question back in 2011. I have had great success with simply fading the transparency of a black image in Unity UI. Controlling lights can be more dynamic 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

13 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

Related Questions

Why does camera not register color until objects are close up? 0 Answers

Color lerp once? 2 Answers

Problem with fading a colour over time 1 Answer

How to vertex colour a single instance of a GameObject? 1 Answer

While fading object out, it turns black. 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