Onpointerenter and Onpointerexit have a problem. Even with a delay, a quick enter and exit event can occur immediately.
Presumably the reason is that the ToolTip UI is too close to the triggering UI.
Therefore, the problem is solved by providing a distance value for the distance of the Tooltip cue box.
Using Unityengine;
Using Unityengine.eventsystems;
Using Unityengine.ui; public class Test_itemtooltip:monobehaviour, Ipointerenterhandler, Ipointerexithandler, Ipointerdownhandler {public
Gameobject go; public void Onpointerdown (Pointereventdata eventdata) {}///<summary>///Enter trigger display item information///</ summary>///<param name= "eventdata" ></param> public void Onpointerenter (Pointereventdata eventdata ) {go.
SetActive (TRUE); Go. Getcomponent<recttransform> (). Position = new Vector3 (transform.position.x + (go. Getcomponent<recttransform> (). Sizedelta.x/2) +, TRANSFORM.POSITION.Y-(go.
Getcomponent<recttransform> (). SIZEDELTA.Y/2) + 100), 0);
///<summary>///Remove hidden display///</summary>///<param name= "EventData" ></param> public void Onpointerexit (Pointereventdata eventdata) {go.
SetActive (FALSE);
}
}
Reference articles:
1. When quickly move the mouse out of unity will perform the onpointerexit and then execute once Onpointerenter
2.
3.