Skip to content

UI.ImageButton

Name Mandatory Description Default Type
⬅️ Input The value that will be passed to the Action shards of the button. ImageGFX.Texture2D
Output ➡️ Indicates whether the button was clicked during this frame. Bool
Action No The shards to execute when the button is pressed. None NoneShard[Shard]
Scale No Scaling to apply to the source image. @f2(1 1) Float2&Float2
Size Yes The size to render the image at. None Float2&Float2
ScalingAware No When set to true, this image's pixels will be rendered 1:1 regardless of UI context point size. None Bool&BoolNone
Selected No Indicates whether the button is selected. None Bool&BoolNone

Clickable button with image.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
@wire(ui-wire {
  UI.Window(
    Title: "UI Image Button"
    Position: @f2(0 0)
    Anchor: Anchor::Center
    Width: 700
    Height: 400
    Contents: {
      Once({
        asset/r0 | GFX.Texture = uiImage1 ;; replace with whatever image you have as references

      })

      uiImage1 | UI.ImageButton(Action: {
        Msg("Image Button Working")
      })
    }
  )
} Looped: true)

{ui-behavior: ui-wire}