Panel Hovered { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The Hovered property of the WorldInput class represents the Sandbox.UI.Panel that is currently being hovered over by the input device. This property is useful for determining which UI element is under the cursor or pointer at any given time, allowing for interactive UI elements to respond to hover events.

Usage

To use the Hovered property, you need to have an instance of the WorldInput component, typically attached to a player's camera. You can then access the Hovered property to get the current Panel that is being hovered over.

Example usage:

WorldInput worldInput = playerCamera.GetComponent<WorldInput>();
Sandbox.UI.Panel hoveredPanel = worldInput.Hovered;
if (hoveredPanel != null)
{
    // Perform actions with the hovered panel
}

Example

WorldInput worldInput = playerCamera.GetComponent<WorldInput>();
Sandbox.UI.Panel hoveredPanel = worldInput.Hovered;
if (hoveredPanel != null)
{
    // Perform actions with the hovered panel
}