

You can configure when the pressable button fires the OnClick event via the PhysicalPressEventRouter on the button. For example, you can set OnClick to fire when the button is first pressed, as opposed to being pressed and released, by setting Interactable On Click to Event On Press. This event gets triggered for different types of input methods such as gaze, air-tap, hand-ray, as well as physical button presses through the pressable button script. The events exposed in the prefab itself as well as the Interactable component can be used to trigger additional actions. The pressable buttons in the HandInteractionExample scene use Interactable's OnClick event to trigger a change in the color of a cube. These button prefabs are already configured to have audio-visual feedback for the various types of inputs, including articulated hand input and gaze. Simply drag PressableButtonHoloLens2 (Assets/MRTK/SDK/Features/UX/Interactable/Prefabs/PressableButtonHoloLens2.prefab) or PressableButtonHoloLens2Unplated (Assets/MRTK/SDK/Features/UX/Interactable/Prefabs/PressableButtonHoloLens2Unplated.prefab) into the scene. Then, drag PressableButtonUnityUI (Assets/MRTK/SDK/Features/UX/Interactable/Prefabs/PressableButtonUnityUI.prefab), PressableButtonUnityUICircular (Assets/MRTK/SDK/Features/UX/Interactable/Prefabs/PressableButtonUnityUICircular.prefab), or PressableButtonHoloLens2UnityUI (Assets/MRTK/SDK/Features/UX/Interactable/Prefabs/PressableButtonHoloLens2UnityUI.prefab) onto the Canvas. Set the Rect Transform component's X, Y, and Z scale to 0.001.Click "Add NearInteractionTouchableUnityUI".
UNITY3D UI SET ICON IN LIST OF IMAGES HOW TO
How to use pressable buttons Unity UI based buttonsĬreate a Canvas in your scene (GameObject -> UI -> Canvas).


PressableButtonHoloLens2 (Assets/MRTK/SDK/Features/UX/Interactable/Prefabs/PressableButtonHoloLens2.prefab) is HoloLens 2's shell style button that supports the precise movement of the button for the direct hand tracking input. You can also use voice command to trigger the button. The baseline button supports all available input methods, including articulated hand input for the near interactions as well as gaze + air-tap for the far interactions. The TextPic control will add a CanvasGroup control to the TextPic to enable click-through to the button.The Button (Assets/MRTK/SDK/Features/UX/Interactable/Prefabs/Button.prefab) is based on the Interactable concept to provide easy UI controls for buttons or other types of interactive surfaces. If the TextPic is added as a child of a Button you cannot use the hyperlinks feature of this control, it is purely decorative allowing the text and image replacement. You have to remove any existing Text components first, else Unity will warn you.Īdditionally, if you want configure hyperlink highlighting colours, simply add a " Selectable" component to the same GameObject as the TextPic control and configure it. It is also available as a Game Component menu in " UI / Extensions / TextPic". Simply add a new TextPic to the scene using " UI / Extensions / TextPic" in the Editor " GameObject" menu. It can also place Images within blocks of Text by adding Icons to the Icon List with a Name, then instances of that name will be replaced with that Image (careful what name you use :D) List of icon replacements and their lookup textĪdd TextPic component instead of the standard Text control and decorate with Rich Text HTML, for example: Override the default color for Hyperlinks Global scaling factor for all images (they default to match the font size) The properties of the TextPic control are as follows: Property
UNITY3D UI SET ICON IN LIST OF IMAGES CODE
HTML code is similar to that used for Unity's native Rich Text HTML Provides a html interpreter to add inline images in Text.
