When you create a new IMGUI GUISkin and render a vertical or horizontal scrollbar, it adds these tiny little arrows to the ends. I have replaced every texture in the GUISkin but they still appear. Anybody know where these arrows come from and/or how to suppress them at least?
Hi @bibbisaurus,
You need to make sure to replace the horizontalScrollbarLeftButton , horizontalScrollbarRightButton , verticalScrollbarDownButton, verticalScrollbarUpButton normal, hover and active with an empty texture.
You could create an empty, placeholder texture like this:
var emptyTexture = new Texture2D(1, 1);
emptyTexture.SetPixel(0, 0, Color.clear);
emptyTexture.Apply();
Let me know if it helped.
Perfect, thanks. I looked at that but it doesn’t have any textures assigned to it. Must be hardcoded internally if no texture present? Anyway, thanks so much for taking time to reply. Cheers!
That’s correct - if there is no texture assigned, a deault arrow will be shown.
@MarekUnity Thanks for confirmation.
At the risk of hijacking my own thread…
I got the reskin working perfect except for Window titles. I made complete GUISkins for 1x, 2x and 3x resolutions, and have 3 fonts at 3 sizes (12, 24, 36). Below is a screenshot where in the OnGUI call I the render 3 times, changing the GUI.skin each loop. In the attached screenshot you can see that the Window title is using the last enabled GuiSkin. It’s an edge use-case, but curious why the Window does that. I had considered that because Windows can be layered and rendered in different orders that that makes a difference, but even when I click and bring other Windows to front it doesn’t change the font size in use for the other 2 windows. Any idea what’s happening here? Everything else seems to be working as expected.
private void OnGUI()
{
// 1x
GUI.skin = guiSkin;
myWindow = GUILayout.Window(0, myWindow, DoWindow, "Window");
// 2x
GUI.skin = guiSkin2;
myWindow2 = GUILayout.Window(1, myWindow2, DoWindow, "Window 2x");
// 3x
GUI.skin = guiSkin3;
myWindow3 = GUILayout.Window(2, myWindow3, DoWindow, "Window 3x");
}
private void DoWindow(int windowID)
{
GUILayout.Space(12 * scaleFactor);
GUILayout.Box("Box");
GUILayout.Button("Button");
myToggle = GUILayout.Toggle(myToggle, "Toggle");
GUILayout.Label("Label");
myText = GUILayout.TextField(myText);
myText = GUILayout.TextArea(myText);
mySlider = GUILayout.HorizontalSlider(mySlider, 0.0f, 1.0f);
mySlider = GUILayout.VerticalSlider(mySlider, 0.0f, 1.0f);
myScroll = GUILayout.HorizontalScrollbar(myScroll, 0.1f, 0.0f, 1.0f);
myScroll = GUILayout.VerticalScrollbar(myScroll, 0.1f, 0.0f, 1.0f);
GUI.DragWindow();
}


