Search Unity

Best way to higlight border of selected object?

Discussion in 'General Graphics' started by MCrafterzz, Oct 5, 2017.

  1. MCrafterzz

    MCrafterzz

    Joined:
    Jun 3, 2017
    Posts:
    354
    I want the selected cube to be highlighted. I have achieved this effect by creating another object and teleporting it to the selected cube. I can be seen here: https://imgur.com/a/duaJW.
    The problem is that it doesn't work when the cube is scaled: https://imgur.com/a/uNxSU.
    So what is the best methoud to get the result of picture one for all cubes with different sizes? Thanks for all help!.

    EDIT: The cubes are created from six panes instead of a cube as the default cube doesn't support multiple textures
     
  2. yackson-cc

    yackson-cc

    Joined:
    May 14, 2016
    Posts:
    48
    Hi,

    do you test reseach about shaders for highlighted selected objects?
     
  3. MCrafterzz

    MCrafterzz

    Joined:
    Jun 3, 2017
    Posts:
    354
    I have doon some search and found multiple shades that don't work. Even I find one that works as I want how should I turn on/off the highlights without changing it for the shader and therefor all object? Or is it best to change between shaders?
     
  4. eXonius

    eXonius

    Joined:
    Feb 2, 2016
    Posts:
    207
    You could just assign a separate material for the highlighted object during the time it's highlighted.
     
    Roman200333, sami1592 and yackson-cc like this.
  5. yackson-cc

    yackson-cc

    Joined:
    May 14, 2016
    Posts:
    48
    you can have two material how public vars, first material within texture and non-highlighted, and second material is only the shader that highlighted the object, in your code must asing the material highlighted when the object is selected, and asign the normal material when the object is not selected.
     
  6. MCrafterzz

    MCrafterzz

    Joined:
    Jun 3, 2017
    Posts:
    354
    Do you have a link to a working outline shader? I remeber find one that worked but it didn't hightligh the object like I wanted (like in the picture)
     
  7. neubiole

    neubiole

    Joined:
    Oct 15, 2017
    Posts:
    14
    Maybe you can find this link helpful:

    I'm not an expert in graphics but my interest on it allows me to learn new things.
     
    amRahulkankarej and MCrafterzz like this.
  8. MCrafterzz

    MCrafterzz

    Joined:
    Jun 3, 2017
    Posts:
    354
    Thanks, will take a look
     
  9. Sword-Master

    Sword-Master

    Joined:
    Aug 29, 2017
    Posts:
    16