Unity 2021.1 Conflicts With Visual Scripting And UIS [ Antlr3 - NCalc ]

Good evening everyone,

With the new Unity 2021.1 version in our midst i decided i want to utilize its features for my project and previously i was in Unity 2019.4f where operation was no problem.

With the upgrade to Unity 2021.1 I decided to take a plunge in trying the new Visual Scripting since it would improve coding around, but i'm afraid conflicts arise with the Antlr3 and NCalc Libraries and I want to ask for your help regarding that.

The dirty solution to this is to move the libraries from Visual scripting to the asset folders and simply use that, but this is not optimal since any update that could come from either UIS or Visual Scripting Will break this.

What could you suggest regarding this particular issue?

Thank you kindly for the time you took in reading this.
 
We tried fixing this issue two releases ago by renaming the library and it ended up causing more issues than it solved. So I am afraid that until we decide to replace those libraries by something else the best approach is the one you mentioned: removing the library from either UIS or Bolt and then manually update the assembly definitions. This should take no more than 3-5min to do and only needs to be done when you update either package.
At some point we will look into replacing Antlr3 and NCalc by something else, perhaps another library or a custom implementation. It is used for parsing the Modify expressions in Item Attributes, which I have planned to refactor for v1.2 or v1.3 of UIS (not the near future)

I hope that makes sense, and I am sorry for the inconvenience.
 
I think you'd have to anticipate the refactor asap cause when the asset is not compatible with Unity itself it's not a good look

Can you please explain step by step how to do this? I couldn't do it myself ^^
 
So I tried it for myself and turns out they changed some things when they made Bolt into a package which makes things a lot more complicated to work around... I think you are right, we will need to fix this sooner rather than later.

In the meantime here is the work around I found, that you can use until we find a better solution.

0) Install UIS and Visual Scripting packages.
1) Delete the Antlr3.Runtime and NCalc dll from the Assets/Opsive/UltimateInventorySystem/Plugins folder
2) Reference the Unity.VisualScripting.Flow assembly definition in our Opsive.UltimateInventorySystem definition, Press Apply.
3) Go to the AttributeBase script, replace:
Code:
using NCalc;
by
Code:
using Unity.VisualScripting.Dependencies.NCalc;
4) Since the Bolt NCalc library was customized for Bolt, some functions are different. So on line ~1022-3 replace:
Code:
e.Evaluate();
by
Code:
e.Evaluate(null);

That should fix the issues related with the dlls.

Then additionally there's 1 ambiguous type error and 1 obsolete warning with unity 2021.1. for other unrelated scripts.
For the RadioButtonGroup error make sure to use the Opsive type by adding:
Code:
using RadioButtonGroup = Opsive.Shared.Editor.UIElements.RadioButtonGroup;

For the obsolete warning simply replace it with:
Code:
m_ContentPanel.verticalScrollerVisibility = ScrollerVisibility.AlwaysVisible;

I'll fix those for the next update.
 
Good news, I found a way to remove the NCalc and Antlr3 dependency, we will be using something else instead which is built-in Unity.
Thanks for pointing out the issue early so we could get it fixed before the next update.
 
Good news, I found a way to remove the NCalc and Antlr3 dependency, we will be using something else instead which is built-in Unity.
Thanks for pointing out the issue early so we could get it fixed before the next update.
Awesome to hear that! And thanks for the workaround in the meantime, I was definitely skipping at least one step, that's why I couldn't make it work ^^
 
Top