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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Texture2D.blackTexture

Discussion in 'Documentation' started by Ferazel, Jan 19, 2016.

  1. Ferazel

    Ferazel

    Joined:
    Apr 18, 2010
    Posts:
    513
    Looking at Texture2D it looks like the Texture2D.blackTexture documentation may have a typo. The values I'm getting out of the texture when I put it into a shader is 0,0,0,0 not 0,0,0,1. This is similar to the default texture on shader parameters where the "black" texture is 0,0,0,0.

    Can we confirm that this is indeed a typo?

    http://docs.unity3d.com/ScriptReference/Texture2D-blackTexture.html
     
    Last edited: Jan 19, 2016
  2. duck

    duck

    Unity Technologies

    Joined:
    Oct 21, 2008
    Posts:
    358
    Well... the docs are indeed wrong here, however it probably wasn't a typo. It could be argued that it would make more sense for the function to return 0,0,0,1 because that's opaque black, as opposed to "transparent black" which is a bit odd! I expect that the whoever wrote that page assumed the function did the sensible thing without actually checking!

    However, the property does indeed return 0,0,0,0 so I will update the docs accordingly.

    We can't change the API to return 0,0,0,1 because there are likely projects out in the wild now which rely on this value. o_O
     
  3. duck

    duck

    Unity Technologies

    Joined:
    Oct 21, 2008
    Posts:
    358
    This page has now been updated online!