Search Unity

Create effect dark and light when game start

Discussion in '2D' started by ba01, Sep 18, 2014.

  1. ba01

    ba01

    Joined:
    May 8, 2014
    Posts:
    10
    I am new in unity, i need to create a effect when my game is started:

    + When game is being started, game scene is dark
    + When game has already been started, game scene is light.

    Please teach me how i can do it, Thanks so much.
     
  2. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    Could do it with a `multiply` shader with a quad covering the screen, fade-up the tint color from black to white.
     
  3. Kawaburd

    Kawaburd

    Joined:
    Jul 22, 2013
    Posts:
    16
    Another way, make a sprite that's nothing but a black box. stick it in a prefab, child it to the camera and scale it across the whole view. Change the black box's alpha channel to determine how visible it is, using the sprite's color var. Better yet, use a white box, then you can change the color itself as well. Make it black by doing this:

    sprite.color = new Vector3( 0, 0, 0, 1); // The first 3 vars are RGB, the 4th is alpha or transparency. 0 is invisible, 1 is opaque. Everything in between is... well, self-explanatory.

    It's great for cutscenes too. You can just deltaTime to fade things in and out as needed.
     
    ba01 likes this.
  4. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    If you are using lighting, I guess you could modify the ambient light color?
     
  5. ba01

    ba01

    Joined:
    May 8, 2014
    Posts:
    10
    Hi imaginaryhuman.

    I don't know about "a `multiply` shader with a quad covering the screen".

    could you send me a example about this ? Thanks so much.
     
  6. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    No. Create a cube, make it cover the camera, make it a child of the camera, choose a material for the quad which has a MULTIPLY shader on it.
     
    ba01 likes this.