Targeting .NetStandard Nuget Package Error

I am currently trying to integrate the Nuget package Rystem.OpenAi into my unity package, on install I get an error stating that my project targets .netframework 4.7 instead of .net standard 2.1. However when I go to Edit->Project Settings → Player → API ref I find the project targets .net standard 2.1.

I searched the entire solution for references for .netframework 4.7.1 and couldn’t find any references.

What am I missing here?

There is Scripting Runtime Version which is 3.5 or 4.0 equivalent

There is API Compatibility level, which is .NET standard 2.0 or .NET 4.x

Both of the above are under the Player settings, as you found already.

These values may be different on your version of Unity, or your selected target.

Dunno about your NuGet usage, but anything that does not modify something either within Assets/ or Packages/ is irrelevant and Unity won’t see it.

In other words, NuGeting from Visual Studio / Ryder will not normally change anything from Unity’s standpoint.

I’ve heard of a NuGet for Unity but haven’t used it.

You’d have to get that OpenAI project outside of nuget, for example download (and if necessary compile) the source code repository. You’ll have to bundle this code inside your package, otherwise you cannot distribute the package since a package can only have dependencies on other npm Unity packages, not nuget packages.

The Nuget for Unity won’t help because it needs to be installed separately, and it adds itself to the Assets tree with a bunch of DLLs and what not. This was causing so many issues, notably slowdowns, so I quickly uninstalled it again.

Thanks a lot, that makes a lot of sense. I just spent a couple of bucks on a unity API wrapper and works perfectly.

Thank you! That was exactly the problem, I didn’t realize the Unity project would act in this way. Problem solved!

Smart. Those are almost always useful, as long as they get maintained and loved.

You should shout-out the asset you used, give the maker some more eyeballs because Google will probably show this thread to others attempting to integrate that same AI package.

For example, we used this one for OpenCV a while back and it saved us all an incredible amount of time.

https://assetstore.unity.com/packages/tools/integration/opencv-for-unity-21088

Good point!

It was this one! They have a few features that are not currently included but I hope they will be added soon!