Search Unity

  1. Engage, network and learn at Unite Austin 2017, Oct 3 - 5. Get your ticket today!
    Dismiss Notice
  2. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  3. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  4. Unity 2017.1 is now released.
    Dismiss Notice
  5. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  6. Unity 2017.2 beta is now available for download.
    Dismiss Notice

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:
    42
    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 Moderator

    Joined:
    Apr 11, 2010
    Posts:
    19,669
    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:
    42
    But what kind of material would create this effect?
     
  4. DroidifyDevs

    DroidifyDevs

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

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    3,947
    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..