Search Unity

How to create a highlighting or flashing object?

Discussion in 'Scripting' started by Ricks, Aug 29, 2014.

  1. Ricks

    Ricks

    Joined:
    Jun 17, 2010
    Posts:
    650
    How is an effect like this created, where a glow or flashy lighting moves over the object to signalize it?
    Lighting.jpg

    The screenshot is from this video (and the highlighting occurs multiple times within the first 40 seconds). It is a common effect used in games, however I'd like to know how this is done, or if there is an asset available providing the same functionality?
     
  2. TRG96

    TRG96

    Joined:
    Mar 26, 2011
    Posts:
    102
  3. Ricks

    Ricks

    Joined:
    Jun 17, 2010
    Posts:
    650
    Was afraid so. Not much into shader programming either :(

    A package on the asset store would be fine too (preferably not requiring Unity Pro)... guess I'll take a look now.
     
  4. seejayjames

    seejayjames

    Joined:
    Jan 28, 2013
    Posts:
    691
    You probably wouldn't need to program a shader, you just need to use one on your objects which gives a range of light values (from dark to fully white). Off the top of my head I'm not sure which to try. But when you find one that has a parameter you can change that makes your object lighter, you can then tweak the parameter in code.

    Another option: have a second object on top of your object, just a flat plane the same size, and show/hide it. Though the flash wouldn't be able to scroll like in the video...
     
  5. Ricks

    Ricks

    Joined:
    Jun 17, 2010
    Posts:
    650
    Hmmm... regarding the first suggestion: this would brighten up the whole object, not a specific area, therefore it wouldn't look like flashing. But I'll keep that in mind, maybe it turns out the flashing light will not look that good anyways.

    Regarding the second suggestion: a flat plane would not look good for a 3-dimensional object, but the scrolling could actually be done with a simple texture scroll script - meaning that with a 2nd material having some kind of light-dark gradient on top of the main texture this might be possible. Not sure though. So, yeah... seems there are some ways to trick around effects.

    Thanks for the suggestions :)