Last active
January 1, 2016 00:29
-
-
Save tsubaki/8066386 to your computer and use it in GitHub Desktop.
[Unity] Resourcesに配置したパック済みのSpriteを取得する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Sprite Load (string fileName , string spriteName) { | |
// Resoucesから対象のテクスチャから生成したスプライト一覧を取得 | |
Sprite[] sprites = Resources.LoadAll<Sprite>(fileName); | |
// 対象のスプライトを取得 | |
return System.Array.Find<Sprite>( sprites, (sprite) => sprite.name.Equals(spriteName)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment