title: How do I access sprite meta data in Unity?
body: <p>I am using Unity's native sprite editor to slice up a texture as a spritesheet.  I would like to be able to then get an array of all the sprite slice via scripting.</p>
  
  <p>For example I would like to have a SpriteSheet class that could be used like this.</p>
  
  <pre><code>class MyClass
      // Drag sprite sheet from assets to this inspector slot.
      public SpriteSheet spritesheet;
  
      void Awake() {
          foreach(Sprite sprite in spritesheet.sprites) {
              ... do something with sprite
          }
      }
  }
  </code></pre>
  
  <p>But it seems that the sprite sheet is nothing more than a Texture2D with a .meta associated with it.  There is a TextureImporter class that has a spritesheet property but how do I access the TextureImporter during runtime?  Even if I could access during EditTime I could use it to populate a Sprite[] which right now is being maintained by hand, which is painful for hundreds of sprites.</p>
  
  <p>Any advice would be appreciated.</p>