HintOverlay Class |
Namespace: KSPDev.GUIUtils
The HintOverlay type exposes the following members.
Name | Description | |
---|---|---|
![]() | HintOverlay | Constructs an overaly. |
Name | Description | |
---|---|---|
![]() | ShowAtCursor | Shows hint text at the current mouse pointer. |
![]() | ShowAtPosition | Shows hint at the absolute screen position. |
Name | Description | |
---|---|---|
![]() | LeftSideMousePadding | Padding when showing hint on the left side of the mouse cursor. |
![]() | RightSideMousePadding | Padding when showing hint on the right side of the mouse cursor. |
The overlay windows don't have a border or title. The main purpose of such windows is present the "hints". I.e. short a lived piece of information presented for the current context. The hint won't be shown in UI until explicitly requsted via a call to the ShowAt* method.
Keep in mind that this window resources will be destroyed when the scene is re-loaded. I.e. the hint window must be re-created on every scene change.
class MyMod : MonoBehaviour { HintOverlay hint; void Awake() { hint = new HintOverlay(12, 3, Color.white, new Color(0f, 0f, 0f, 0.5f)); } void OnGUI() { hint.text = string.Format("Current frame is: {0}", Time.frameCount); hint.ShowAtCursor(); } }
In the example above text of the hint is set on every frame update since frame count is updated this frequently. Though, if your data is updated less frequently you may save some performance by updating text in the methods different from OnGUI.