UI.LastElementFocused
static BtnState LastElementFocused{ get }
Description
Tells the Focused state of the most recently called UI element that used an id.
Examples
Checking UI element status
It can sometimes be nice to know how the user is interacting with a particular UI element! The UI.LastElementX functions can be used to query a bit of this information, but only for the most recent UI element that uses an id!
So in this example, we’re querying the information for the “Slider” UI element. Note that UI.Text does NOT use an id, which is why this works.
UI.WindowBegin("Last Element API", ref windowPose);
UI.HSlider("Slider", ref sliderVal, 0, 1, 0.1f, 0, UIConfirm.Pinch);
UI.Text("Element Info:", TextAlign.TopCenter);
if (UI.LastElementHandActive (Handed.Left ).IsActive()) UI.Label("Left Active");
if (UI.LastElementHandActive (Handed.Right).IsActive()) UI.Label("Right Active");
if (UI.LastElementHandFocused(Handed.Left ).IsActive()) UI.Label("Left Focused");
if (UI.LastElementHandFocused(Handed.Right).IsActive()) UI.Label("Right Focused");
if (UI.LastElementFocused .IsActive()) UI.Label("Focused");
if (UI.LastElementActive .IsActive()) UI.Label("Active");
UI.WindowEnd();
Found an issue with these docs, or have some additional questions? Create an Issue on Github!