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. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Resolved Is there any way to register Type Options and Node Library from script?

Discussion in 'Visual Scripting' started by SolarianZ, Aug 17, 2022.

  1. SolarianZ


    Jun 13, 2017
    Is there any way to register Type Options and Node Library from script?

  2. PanthenEye


    Oct 14, 2013
    Decorate your classes with [IncludeInSettings(true)] attribute. You still have to regen nodes manually, though. There was API for that as well, something along the lines of UnitOptions.Update() or some such.
    REDACT3D_ and ironwolf like this.
  3. ironwolf


    Oct 26, 2010
    @PanthenEye Thank you very much for this information. I was looking for an option to exclude some classes from Node Generation and it seems that [IncludeInSettings(false)] do the trick :)

    I wonder if there is an option to exclude whole namespace?

    And is there some place where all these attributes are documented?
    I can find them manually in script refs:
    but I have to guess what each of them possibly do and how to use it :(
  4. PanthenEye


    Oct 14, 2013
    I don't believe so. It was supported in Bolt 2 which has since been discontinued.

    I'm also not aware of any Unity docs covering these more esoteric attributes. My knowledge comes from being and ex-Bolt 1 user from the early days before Unity acquired it and rebranded it to UVS.

    They're currently working on a new major version of Unity visual scripting. The whole workflow might change once that drops in a year or two. It's not confirmed but I believe it's likely to be a major if not full rewrite.
    REDACT3D_ likes this.
  5. Trindenberg


    Dec 3, 2017
    I do wonder if there's a way to strip/trim the massive node database of unused items, and whether that would speed things up/lessen memory hog. Just the basic setup from start is 20k database items, which assume go into memory for lookup at runtime. Is a dictionary much quicker to find 1 of 200 items than 1 in 20000 items?

    And yes you can access/update/remove from Type/Node options via script but I'm rusty at this point on it.
  6. REDACT3D_


    Nov 8, 2020

    When an update drops after you complete the certification


    still.. excited to see some improvements
  7. PanthenEye


    Oct 14, 2013
    The new version will have the high-performance interpreted runtime which means a new custom node API. And it'll migrate from current IMGUI UI solution to Graph Tools Foundation graph framework they're cooking up so UI/UX will also completely change technologies and ways of scripting it. And since they're making these major changes, it's likely they will migrate from FullSerializer to Unity's native one which is a lot more limited so it's unclear what'll happen with graph format, etc. If it won't be directly backwards compatible, it should at least have a migration tool for native nodes and reflected nodes. Custom nodes are unlikely to survive the transition.

    It's also unclear if they'll go beyond that as far as the overall framework and its API is concerned, they stopped communicating with the community a couple months ago so it's a toss up. Time will tell but timelines are also unclear, this new major version depends on Graph Tools Foundation being present and they're in the process of integrating it within the core of the engine and 2023.1 alpha doesn't have it yet so it might not come until Unity 2024.1 or later.

    Long story short, current UVS isn't going away anytime soon, it's likely to remain as is for the next two years at least. But it's just my speculation.
    Yuchen_Chang and REDACT3D_ like this.
  8. SolarianZ


    Jun 13, 2017
    You can access Type Options through property `BoltCore.Configuration.typeOptions` and access Node Library through property `BoltCore.Configuration.assemblyOptions`. After modifying the properties, you should call `PluginConfigurationItemMetadata.Save()`, `Codebase.UpdateSettings()` and `UnitBase.Rebuild()`.

    Sample Codes (Tested on Unity 2021.3.0):
    Code (CSharp):
    1. [MenuItem("Window/Bamboo/Visual Playable/Setup Playable Nodes")]
    2. public static void Setup()
    3. {
    4.     var boltTypeOptionsChanged = false;
    5.     var coreConfig = BoltCore.Configuration;
    6.     foreach (var type in CollectPlayableTypes())
    7.     {
    8.         if (!coreConfig.typeOptions.Contains(type))
    9.         {
    10.             coreConfig.typeOptions.Add(type);
    11.             Debug.Log($"Add {type.FullName} to Visual Scripting type options.");
    12.             boltTypeOptionsChanged = true;
    13.         }
    14.     }
    16.     if (boltTypeOptionsChanged)
    17.     {
    18.         var typeOptionsMetadata = coreConfig.GetMetadata(nameof(coreConfig.typeOptions));
    19.         typeOptionsMetadata.Save();
    20.         Codebase.UpdateSettings();
    21.         UnitBase.Rebuild();
    22.     }
    24.     // coreConfig.assemblyOptions.Add(xxx);
    25.     // var assemblyOptionsMetadata = coreConfig.GetMetadata(nameof(coreConfig.assemblyOptions));
    26.     // assemblyOptionsMetadata.Save();
    27.     // Codebase.UpdateSettings();
    28. }
    PanthenEye likes this.