UnityEditor.GradientEditor.GetBackgroundTexture C# (CSharp) Method

GetBackgroundTexture() public static method

public static GetBackgroundTexture ( ) : Texture2D
return UnityEngine.Texture2D
        public static Texture2D GetBackgroundTexture()
        {
            if (s_BackgroundTexture == null)
            {
                s_BackgroundTexture = CreateCheckerTexture(0x20, 4, 4, Color.white, new Color(0.7f, 0.7f, 0.7f));
            }
            return s_BackgroundTexture;
        }

Usage Example

コード例 #1
0
        private static void DrawGradientSwatchInternal(Rect position, Gradient gradient, SerializedProperty property, Color bgColor)
        {
            if (Event.current.type != EventType.Repaint)
            {
                return;
            }
            Texture2D backgroundTexture = GradientEditor.GetBackgroundTexture();

            if (backgroundTexture != null)
            {
                Color color = GUI.color;
                GUI.color = bgColor;
                GUIStyle basicTextureStyle = EditorGUIUtility.GetBasicTextureStyle(backgroundTexture);
                basicTextureStyle.Draw(position, false, false, false, false);
                GUI.color = color;
            }
            Texture2D texture2D;

            if (property != null)
            {
                texture2D = GradientPreviewCache.GetPropertyPreview(property);
            }
            else
            {
                texture2D = GradientPreviewCache.GetGradientPreview(gradient);
            }
            if (texture2D == null)
            {
                Debug.Log("Warning: Could not create preview for gradient");
                return;
            }
            GUIStyle basicTextureStyle2 = EditorGUIUtility.GetBasicTextureStyle(texture2D);

            basicTextureStyle2.Draw(position, false, false, false, false);
        }
All Usage Examples Of UnityEditor.GradientEditor::GetBackgroundTexture