LoginSignup
2
2

More than 5 years have passed since last update.

【Unity】標準で用意されているコンポーネントのアイコン画像の取得方法

Posted at

今回は標準で用意されてるコンポーネントのアイコン画像の取得方法を書こうと思います。内容は短めです。
バージョンは2017.3.1f1です。

2018-03-21_03h04_36.png

やり方

やり方はAssetPreviewクラスにあるGetMiniThumbnailの引数に表示したいコンポーネントのインスタンスを入れるだけです。戻り値はTexture2Dで返ってきます。

URL:https://docs.unity3d.com/jp/540/ScriptReference/AssetPreview.GetMiniThumbnail.html

例:transformのアイコンを取得する

Texture2D icon = AssetPreview.GetMiniThumbnail(gameObject.transform);

また、Typeを渡して取得するGetMiniTypeThumbnailというのもあります。

Texture2D icon = AssetPreview.GetMiniTypeThumbnail(typeof(Transform));
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2