Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question GUI.Box is darker

Discussion in 'Immediate Mode GUI (IMGUI)' started by Rachan, Aug 18, 2023.

  1. Rachan

    Rachan

    Joined:
    Dec 3, 2012
    Posts:
    725
    Hi there!

    I made a custom editor and using GUI.color and GUI.Box

    so, I call GUI.Color = Color.green; to set a color first
    and GUI.Box() to draw a green box later
    But the result is very dark not green as I want


    What happen? or I did something wrong?

    Thanks!!!


    Code (CSharp):
    1.  
    2.  
    3. EditorGUILayout.BeginHorizontal();
    4.         GUI.color = Color.black;
    5.         GUI.Box(new Rect(10,170,position.width-20,20), GUIContent.none);
    6.         GUI.color = Color.green;
    7.         GUI.Box(new Rect(10,170, (position.width - 20) * NormalizedProgress, 20),GUIContent.none);
    8.         GUI.color = Color.white;
    9.         GUI.Label(new Rect(10, 200, 100, 30), FormattedProgress);
    10.          
    11. EditorGUILayout.EndHorizontal();
    12.  
    13.  
     
    Last edited: Aug 18, 2023