Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

Vertexlit specular shader conflict with higlight script

edited May 2014 in Technical Q&A
Hi :) I'm using as a vertexlit specular shader wich uses alpha channel to fake specularity...when I use the higlight script on the objects with this shader Is like the script doesn't affect at all the material...why?



  • I'm afraid I don't know the answer to that - I don't know shader code at all.

    However, you can get the intended highlight amount from the Highlight script and use it in your own script.  Enter this code into a C script attached to the same object as the Highlight component:

    float highlightAmount;
    void Update ()
      highlightAmount = this.GetComponent <Highlight>().GetHighlightAlpha ();

    The "highlightAmount" float will be set to 0 when unlit, and 1 when highlighted, which you can use to light your object indirectly.
  • I guess I'm doing something wrong :/

    I have to leave the higlight script to on the object and add this or I have to put just the new script?

    is this code right?


  • Get rid of the Start function and that's right.  You'll need to find a way to link the highlightAmount float to your shader's brightness your own way, though (since that kind of thing will be specific to your game)
  • The higlight script doesn't work with the native mobile unity shader either...:(
  • edited May 2014
    The Highlight script changes the colour of it's object's materials.  To improve performance, Unity's mobile shader doesn't have a colour field like the "regular" one does.  Because every shader is different, it's impossible to write a "Highlight" script that just works for any shader - you literally can't brighten the mobile shader.
  • yeah I tought so...they don't have the color field...and what if I post here a shader and u put me in the right direction to make the higlight script to works? :)
  • Not me, I'm afraid - you'd have a better chance on either the "Extending the Editor" forum or even Google.  Shader scripts are a foreign language to me.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!