Skip to content
This repository was archived by the owner on Dec 12, 2023. It is now read-only.
This repository was archived by the owner on Dec 12, 2023. It is now read-only.

Hint for anyone trying to use this with runtime UI Toolkit #10

Open
@patrickp-unity3d

Description

@patrickp-unity3d

You'll need to populate s_RootVisualElement, but otherwise paste works thanks to this excellent plugin.

    static void SendKey(string baseKey)
    {
        if (s_RootVisualElement == null)
            return;
        
        string appleKey = "%" + baseKey;
        string naturalKey = "^" + baseKey;

        {
            var evt = Event.KeyboardEvent(naturalKey);
            using var keyEvt = KeyDownEvent.GetPooled(evt);
            s_RootVisualElement.SendEvent(keyEvt);
        }
        {
            var evt = Event.KeyboardEvent(appleKey);
            using var keyEvt = KeyDownEvent.GetPooled(evt);
            s_RootVisualElement.SendEvent(keyEvt);
        }
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions