Search Unity

Making a gameobject solid white (like shmup damage)

Discussion in 'Getting Started' started by unfungmz, Sep 14, 2017.

  1. unfungmz

    unfungmz

    Joined:
    Jul 29, 2017
    Posts:
    162
    My game is 2.5D so my characters are planes with pre-rendered graphics. Is there a way to make my current frame solid white while retaining the alpha? This is a popular technique in shmups where, when you hit an enemy, they turn white momentarily but retain the alpha. I don't want to have to load an entire set of images that are solid white, so I'm wondering if there's a way to do it via scripting.
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Sure, swap the renderer's sharedMaterial for another for the duration of the flash, then restore the original sharedMaterial.
     
    Xepherys likes this.
  3. unfungmz

    unfungmz

    Joined:
    Jul 29, 2017
    Posts:
    162
    But what kind of material would create this effect?
     
  4. DroidifyDevs

    DroidifyDevs

    Joined:
    Jun 24, 2015
    Posts:
    1,724
    A white material.
     
    Xepherys likes this.
  5. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
    other options
    set material color with script, like tint, if your shader has it.
    if thats not bright enough, customize shader to make it whiter * 2, or to have it lerp between current color and white by adjusting lerp from 0 to 1 in script..