Search Unity

Texture2D or Texture

Discussion in 'Scripting' started by boylesg, May 31, 2016.

  1. boylesg

    boylesg

    Joined:
    Feb 18, 2016
    Posts:
    275
    I have a png that I was using as a sprite, but now I want to use it as a texture.
    So when doing Resource.Load(...), what would I load it as?

    A Texture2D or a Texture?
     
  2. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    Texture2D. Texture is the base class from which Texture2D, Texture2DArray (5.4), Cubemap, etc. (different types of textures) inherit from.

    You're loading in a sprite, which is a 2D texture.