Faced a problem - Unity itself darkens all drawn sprites / images (draw via GUI) Screen in debugger

The screen clearly shows - my picture of a green apple (right in the editor), the unit draws very dark, despite the fact that it is quite light. This happens with all the pictures. I did not find any settings in GUIStyle relating to the method of drawing a picture. Also, GUI.Color = new Color (1f, 1f, 1f, 1f) does not help - that is, even if I tell him to draw "without changes", the darkening remains: (

I wrote windows for the editor, the render in them is absolutely identical - the same incomprehensible shading: Screen editing windows

I thought maybe this problem is related to the lighting settings - but none of the lighting settings change anything.

Here is the listing of my drawing service for the cell:

public

class ItemDrawService { private GUIStyle labelStyle = null; public ItemDrawService(GUIStyle labelStyle){ this.labelStyle=labelStyle; } /// <summary> /// ΠžΡ‚Ρ€ΠΈΡΠΎΠ²ΠΊΠ° ΠΏΡ€Π΅Π΄ΠΌΠ΅Ρ‚Π° Π² ΠΈΠ½Π²Π΅Π½Ρ‚Π°Ρ€Π΅ /// </summary> /// <param name="item">РисуСмый ΠΏΡ€Π΅Π΄ΠΌΠ΅Ρ‚</param> /// <param name="offsetX">Π‘ΠΌΠ΅Ρ‰Π΅Π½ΠΈΠ΅ (позиция) инвСнтаря ΠΏΠΎ x</param> /// <param name="offsetY">Π‘ΠΌΠ΅Ρ‰Π΅Π½ΠΈΠ΅ (позиция) инвСнтаря ΠΏΠΎ y</param> /// <param name="fixWebPosition">ΠΏΡ€ΠΈ fixWebPosition=true ΠΏΡ€Π΅Π΄ΠΌΠ΅Ρ‚ рисуСтся "Π² сСткС"</param> /// <param name="drawIcon">ΠΏΡ€ΠΈ drawIcon=false, ΠΏΡ€Π΅Π΄ΠΌΠ΅Ρ‚ рисуСтся Π±Π΅Π· ΠΈΠΊΠΎΠ½ΠΊΠΈ</param> public void DrawItem(ItemSlot item, float offsetX, float offsetY, bool fixWebPosition = true, bool drawIcon = true){ Rect cellRectangle; if (fixWebPosition) { cellRectangle = new Rect(offsetX + CellSettings.cellPaddingX + (item.position.X - 1) * CellSettings.cellWidth, offsetY + CellSettings.cellPaddingY + (item.position.Y - 1) * CellSettings.cellHeight, CellSettings.cellWidth, CellSettings.cellHeight); } else { cellRectangle = new Rect(offsetX, offsetY, CellSettings.cellWidth, CellSettings.cellHeight); } if (drawIcon) labelStyle.normal.background = item.item.resource.icon; string description = item.item.getCount()>1? item.item.getCount().ToString()+CLang.getInstance().get(Dictionary.K_COUNT) : ""; GUI.color = new Color(1f,1f,1f,1f); GUI.Label(cellRectangle, description, labelStyle); } } 

How can I display a picture in the "As is" unit, without any filters?

    1 answer 1

    The solution was simple, change the Color Space to Gamma in the settings: Edit / Project settings / Player /

    screen

    If you need to leave the Linear settings, there are 2 more solutions (taken from the documentation )

    GUI and linear textures

    When rendering the Unity GUI, we do not render in linear space. This means that GUI textures should not remove gamma correction when reading. This can be achieved in two ways:

    • Specify GUI texture type in texture import settings
    • Mark the 'Bypass sRGB Sampling' checkbox in the advanced texture import mode (Texture Type should be set to Advanced)