Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question UI Toolkit Radial Menu

Discussion in 'UI Toolkit' started by joshmond, Aug 8, 2023.

  1. joshmond

    joshmond

    Joined:
    May 28, 2012
    Posts:
    34
    Hey guys, I'm just exploring more of UI Toolkit's features and I was looking for any feedback on how to create a radial-style menu such as the image linked below (sort of like a Counter Strike radial menu or a Diablo 4 radial menu). I know it is possible to create custom components but I've not seen anything like this done with UI Toolkit. So I am looking for some direction for the implementation if this is possible?


    https://www.slythergames.com/wp-content/uploads/Diablo-4-How-to-Use-Emotes-Radial-Menu.webp

    Thanks in advance
     
    Last edited: Aug 8, 2023
  2. DarkRewar

    DarkRewar

    Joined:
    Jan 19, 2015
    Posts:
    18
    It's impossible to achieve this kind of UI with native UITK controls.

    You need to create a custom control to get this. You could follow this sample from Unity which is a pretty good starter: https://docs.unity3d.com/Manual/UIE-radial-progress-use-vector-api.html

    My recommandation:
    - Create a `RadialMenu` custom control ;
    - Add a callback to `generateVisualContent ` to override the renderer (see the link above) ;
    - Use the vector API to draw each "button" on the circle ;
    - Expose a method or a property to set each emote-button ;
    - Add a `Label` and/or a `VisualElement` as an icon for each emote-button and place it using cos and sin functions.

    Hope it'll help!
     
  3. joshmond

    joshmond

    Joined:
    May 28, 2012
    Posts:
    34
    Thanks for the information, I'll definitely check out that Vector API