Piotr Adamczyk
Piotr Adamczyk

Reputation: 41

Unity - NuGet package gets auto-removed

I've created an Unity project, and want to use the OpenNI wrapper from here https://github.com/falahati/NiWrapper.Net. After adding the NuGet package in JetBrains Rider it appears and is installed correctly (is usable) but after a minute or two -the package disappears and Rider warns me that it can't resolve symbols from the wrapper and the namespace OpenNIWrapper could not be found... But what's strange it still appears in "Packages" of the project.

I'm using the newest MacOS Mojave, already tried on VS for Mac, MonoDevelop and in Rider... I've tried removing the project and creating it from scratch, tried to change API Compatibility Level in Unity - both 4.0 and 2.0 don't work.

I noticed that it does some kind of auto-synchronization or build and deletes the package from .csproj file.

Basically I've run out of ideas and couldn't find any solutions anywhere... I'll appreciate any help, thanks :)

Upvotes: 2

Views: 3391

Answers (2)

Piotr Adamczyk
Piotr Adamczyk

Reputation: 41

So, basically following @Radomyr and https://www.what-could-possibly-go-wrong.com/unity-and-nuget/ I created a "nuget.config" file telling the project to save packages in the assets - so they are not removed every time:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <config>
        <add key="repositoryPath" value=".\Assets\packages" />
      </config>
    </configuration>

Upvotes: 2

Radomyr Slaboshpitskyi
Radomyr Slaboshpitskyi

Reputation: 481

Unity do not support nuget. In your case IDE added references for nuget packages to csproj but Unity re-create csproj files after each scripts re-import and remove all other data (which IDE added before).

To use third-party package you can chose any of those ways:

Upvotes: 0

Related Questions