示例#1
0
        /// <summary>
        /// Draws the custom icon for an asset using a texture.
        /// </summary>
        /// <param name="guid">The GUID of the asset to draw.</param>
        /// <param name="rect">The Rect in which the item is drawn.</param>
        /// <param name="texture">The texture to draw for the asset icon.</param>
        public static void DrawCustomIcon(string guid, Rect rect, Texture texture)
        {
            Rect textureRect;

            try
            {
                textureRect = new Rect(0.0f, 0.0f, texture.width, texture.height);
            }
            catch
            {
                AssetIconTools.RebuildIconDatabase();
                return;
            }

            DrawCustomIcon(guid, rect, texture, textureRect);
        }
示例#2
0
        /// <summary>
        /// Draws the custom icon for an asset using a sprite.
        /// </summary>
        /// <param name="guid">The GUID of the asset to draw.</param>
        /// <param name="rect">The Rect in which the item is drawn.</param>
        /// <param name="sprite">The sprite to draw for the asset icon.</param>
        public static void DrawCustomIcon(string guid, Rect rect, Sprite sprite)
        {
            Texture2D textureIcon;
            Rect      textureRect;

            try
            {
                textureIcon = sprite.texture;
                textureRect = sprite.rect;
            }
            catch
            {
                AssetIconTools.RebuildIconDatabase();
                return;
            }

            DrawCustomIcon(guid, rect, textureIcon, textureRect);
        }