not very familiar with GUI skin, trying in the game of guessing I’d say that the internal button has a skin which defines by default the “On Hover” behavior, yours does not.
Have you try to check if your custom skin has an option to define the Hover behavior?
What version of unity are you in and what SRP (HDRP, URP, etc)?
still guessing: Have you tried creating a new skin? a clear project with just that GUI? Is there something that might be blocking the Event System raycast?
using UnityEngine;
using UnityEditor;
public class GUIController : EditorWindow
{
public GUISkin mySkin;
// Add menu named "My Window" to the Window menu
[MenuItem("Window/My Window")]
static void Init()
{
// Get existing open window or if none, make a new one:
GUIController window = (GUIController)EditorWindow.GetWindow(typeof(GUIController));
window.Show();
}
void OnGUI()
{
GUI.skin = mySkin;
GUILayout.BeginArea(new Rect(200, 200, 300, 600));
GUILayout.Button("Custom Skin Button");
GUI.skin = null;
GUILayout.Button("WorldIsNotGood");
GUILayout.EndArea();
Debug.Log("calling");
Repaint();
}
}
Repaint wont be that overhead unless you have many many GUI to renderer. Or if we cound make
“this.wantsMouseMove = true” then EventType.MouseDown will be fired everytime you move your mouse, then when MouseDown event occurs, we could call Repaint. That might relief some overload.
I’ll share what I have been discovered so far about this bizzare GUI behaviour.
The custom skin button’s delayed rendering is caused by event that when you stop moving your mouse cursor for second, then automatically EventType.Repaint occurs. I saw a post someone says that delayed event is for showing tooltip rendering when you hover your mouse on some control and stationary for some second.
So, that delayed button highting is just different story, the problem is default button emits EventType.Repaint as soon as mouse cursor enters button rect, but custom style button does not.
Button is rendered using GUIStyle.Draw function. GUI.Button function calls it internally. If you try rendering two different Style,
Yeah, still don’t know how to avoid it Also I noticed some very helpful internal function in UnityCsReferences in GUI:
This is calls “GrabMouseControl(int id)” and “ReleaseMouseControl(int id)” which really helpful to stop mouse events such like hovering on other elements except your current control id, in my case popup window (enum). Default enums have this feature, but I cant replicate this