Archive 17/01/2023.

Android: How to know that any UIElement is touched

1vanK

I have 3D-scene and UI-buttons over it. When user toch button,any other actions should not be doing

I try

void BoardLogic::HandleTouchBegin(StringHash eventType, VariantMap& eventData)
{
    using namespace TouchBegin;
    IntVector2 screenPos = IntVector2(eventData[P_X].GetInt(), eventData[P_Y].GetInt());
    int touchID = eventData[P_TOUCHID].GetInt();

    // UI-element touched
    if (INPUT->GetTouch(touchID)->touchedElement_)
        return;

    // Interaction with scene objects
}

but it does not work. Any tips?

Modanung

GetSubsystem<UI>()->GetElementAt(screenPos, true)?

1vanK

Ah thanks, I absolutely forgot this method, although I used it before