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

Feature Request Multiple Window (Script Graph in BOLT)

Discussion in 'Visual Scripting' started by Juandapp, Jun 9, 2021.

  1. Juandapp

    Juandapp

    Joined:
    May 11, 2016
    Posts:
    53
  2. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    1,595
    I believe UnityVS is sticking to one window workflow, same as other Unity tools such as Shader Graph.
     
  3. Juandapp

    Juandapp

    Joined:
    May 11, 2016
    Posts:
    53
    Yes, but you cannot open 2 graphical windows, it sticks, which means that if you click on an object the graph does not change, but you cannot see 2 graphs at the same time.
     
  4. Ignacii

    Ignacii

    Joined:
    May 23, 2013
    Posts:
    91
    I could do that with Bolt and now it's not possible?! :(
     
  5. ncr100

    ncr100

    Joined:
    Jul 23, 2015
    Posts:
    32
    Confirmed. All the "glue" is there but Unity VS uses just one window:

    1. Open a project with two graphs attached to two Game Objects, A and B. Unity 2022.1.12f1 VS 1.7.8
    2. Select "A" and see the Inspector. "Edit Graph". See the graph for "A".
    3. Use the Menu "Window > Visual Scripting > Visual Scripting Graph". See a new window (excitement!). Choose "Browse to open a graph". Pick "B". The window closes (disappointment!).
    4. See the graph for "B" replaces the graph for "A". Only one script is visible at a time.

    Ideally, whatever the Unity team that wrote the window for e.g "Animation" did, which allows multiple simultaneous tabs, is what the VS team could explore doing.
     
    Ignacii likes this.
  6. ncr100

    ncr100

    Joined:
    Jul 23, 2015
    Posts:
    32
    LOL'ing here .. I hacked the package locally and got it to open, only in a limited UI navigation way, to show multiple Script Graph windows with different scripts.

    Usage:
    upload_2022-8-6_11-20-12.png
    and
    upload_2022-8-6_11-18-10.png
    and
    upload_2022-8-6_11-18-22.png

    Thank you Joachim for mandating that packages be full-source whenever possible.

    1. Copy / paste the "<project>/PackageCache/ .. visualscripting@some.number.here" folder to the "<project>/Packages" folder.
    2. Optionally, notice Unity recompiles, and shows in the Package Manager window that VS is now a "custom" package. SO when you're sick of this hack, delete the pasted folder and maybe re-install VS from the Unity repository
    3. Change a line of code, starting where I put the Debug.Log part, at <project>/Packages/recently-pasted-vs-package@some.number/Editor/VisualScripting.Shared/EmptyGraphWindow.cs:

    Code (CSharp):
    1. private void OpenGraphAsset(UnityObject unityObject, bool shouldSetSceneAsDirty)
    2. {
    3.     shouldCloseWindow = true;
    4.     ScriptGraphAsset scriptGraphAsset = unityObject as ScriptGraphAsset;
    5.     ...
    6.     if (shouldSetSceneAsDirty)
    7.     {
    8.         EditorSceneManager.MarkSceneDirty(SceneManager.GetActiveScene());
    9.     }
    10.     Debug.Log("NICK: opening tab instead of active");
    11.     // GraphWindow.OpenActive(graphReference);
    12.     GraphWindow.OpenTab(graphReference);
    13. }
    4. Then use Window > Visual Scripting > Visual Scripting Graph and do the "Browse" button on a different script. Boom.

    WARNING this might corrupt your scripts. I have not tested this at all. The VS codebase might assume something with static variables, etc.

    Edit: in my limited testing, it works fine for me. No guarantees that it won't melt your laptop however. :p
     
    Last edited: Aug 6, 2022
    Ignacii likes this.
  7. Trindenberg

    Trindenberg

    Joined:
    Dec 3, 2017
    Posts:
    358
    Ignacii likes this.
  8. Ignacii

    Ignacii

    Joined:
    May 23, 2013
    Posts:
    91
    I managed to open a second window by clicking on a Subgraph node inside a graph and then clicking "Open in new window" in the Context Menu that pops up after right-clicking. Works flawlessly and you can keep it forever and open whatever you want. Just like with Bolt. No add-ons required.

    The only feature request we now need is to make this feature easier to find.
     
    shen0100, JFDx3D and ncr100 like this.