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 How can i edit/Extend the Visual scripting Graphs UI

Discussion in 'Visual Scripting' started by S2NX7, Sep 5, 2023.

  1. S2NX7

    S2NX7

    Joined:
    Aug 17, 2021
    Posts:
    26
    I want to know if its possible to edit the UI of the graph window and if so how do i do it like can i add a button to the tool bar or add another side bar?
     
    iScriptz likes this.
  2. termway

    termway

    Joined:
    Jul 5, 2012
    Posts:
    37
    UVS Finder adds a context menu to find the selected unit in graph but it seems quite complicated (it involves injection)
    You can take a look at this script:
    https://github.com/myanko/uvs-finde.../ContextExtension/UVSGraphElementWidgetExt.cs

    Another way to make such a change would be to import the VisualScripting package in your project's local folder (Assets/) and edit the VisualScripting source code directly.
    I personally chose this approach because I wanted more control over VisualScripting (for example to improve error logs, add a summary attribute, ...)
     
    S2NX7 likes this.
  3. S2NX7

    S2NX7

    Joined:
    Aug 17, 2021
    Posts:
    26
    If i edit the files directly it resets after a script reload and it would be difficult to add those changes to a package anyway but i will look into how UVS finder does it
     
  4. S2NX7

    S2NX7

    Joined:
    Aug 17, 2021
    Posts:
    26
    Thanks btw i found how to use Harmony to edit the graphs UI
     
  5. termway

    termway

    Joined:
    Jul 5, 2012
    Posts:
    37
    I'm glad it is working for you.

    Just to clarify for the second method: if you are using the package manager to import VisualScripting you cannot edit the source code.
    However, you can copy and paste the code from the package (Library/PackageCache/com.unity.visualscripting@1.8.0) into your project to modify it. (ex: Assets/ThirdParties/com.unity.visualscripting@1.8.0) and remove the VisualScripting package from the package manager.

    As they don't update this package often it can be a good solution too. In my opinion it is simpler than using Harmony.
     
    Last edited: Oct 6, 2023 at 6:18 PM
  6. S2NX7

    S2NX7

    Joined:
    Aug 17, 2021
    Posts:
    26
    yea the thing is i want to edit visual scripting for the community addons so i cant add those changes to the package if i do it like that
     
    termway likes this.