Пример #1
0
        public static Texture2D DrawTexturePing(Texture2D tx, int size = 60, int txPadding = 6, bool preview = false, int index = -1)
        {
            if (tx == null)
            {
                return(null);
            }

            var content = new GUIContent("name: ", tx.name + "\ntexel: " + tx.texelSize + "\nsize: " + tx.width + "\naniso: " + tx.anisoLevel);

            if (GUILayout.Button(content, GUILayout.Width(size), GUILayout.Height(size)))
            {
                if (preview)
                {
                    EditorUtils.CreateLightmapPreviewWindow(index);
                }

                else
                {
                    EditorGUIUtility.PingObject(tx);
                }
            }

            Rect rect = GUILayoutUtility.GetLastRect();

            rect.x     += txPadding; rect.y += txPadding;
            rect.width -= txPadding * 2; rect.height -= txPadding * 2;
            EditorGUI.DrawPreviewTexture(rect, tx);

            return(tx);
        }