Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

unlit transparent and alpha control (c#)

Discussion in 'Scripting' started by crasse, Jun 24, 2014.

  1. crasse

    crasse

    Joined:
    Mar 28, 2014
    Posts:
    23
    Hi there !

    i'm trying to control the alpha of a texture with an Unlit transparent Shader, problem is with unlit shader i can't access alpha variable using the color.a method (as there is no color). and mainTexture don't allow mainTexture.a.

    is there another way to access alpha in a c# script ?
     
  2. zaxvax

    zaxvax

    Joined:
    Jun 9, 2012
    Posts:
    220
    There is no color in that shader, it's based on it's texture image only.
     
  3. crasse

    crasse

    Joined:
    Mar 28, 2014
    Posts:
    23
    yep i've realised that but as it's called Unlit transparent I thought there was a way to access the alpha value in the script in a similar way as the color featured Shaders (not color.a of course, but maybe something else, i tried to google it, but only found information about shader coding) so no way in script ?

    in fact i'm looking for a shader that don't nearly react to lights and is always 100% self illuminated (similair to self illuminated or unlit) but with alpha variable, to use to simulate a screen display in a scene (and so even if the scene is dark and lot's of shadows come over my screen zone, the image remain luminous, maybe unlit isn't what I should use.
     
    Last edited: Jun 24, 2014
  4. LightStriker

    LightStriker

    Joined:
    Aug 3, 2013
    Posts:
    2,716
    Well, I think you'll probably need to write your own shader.
     
  5. crasse

    crasse

    Joined:
    Mar 28, 2014
    Posts:
    23
    ok, then i'll have more to do than i , but that's a good start for shader coding, as i've never really practiced it before.
     
  6. zaxvax

    zaxvax

    Joined:
    Jun 9, 2012
    Posts:
    220
    Then you should try Transparent/Cutout/Soft Edge Unlit
    If you disable cutoff, then you have texture and color in parameters to play with.
     
    Magiichan likes this.
  7. crasse

    crasse

    Joined:
    Mar 28, 2014
    Posts:
    23
    ok great ! thanks