2

I have exactly the same use case with leaderboard syncing.

I have been trying to install NodaTime 3.1.6 in Unity / Visual Studio, but cannot get it to work.

I installed NodaTime via NuGet Package Manager in Visual Studio and wrote a few lines of code to do the time zone conversion. But when I try to build in Unity I get these errors in the Console:

" CS0246: The type or namespace name 'NodaTime' could not be found (are you missing a using directive or an assembly reference?)"

Also tried to install via command line:

> dotnet add Assembly-CSharp.csproj package NodaTime --version 3.1.6 
info : Adding PackageReference for package 'NodaTime' into project 'Assembly-CSharp.csproj'.
error: Error while adding package 'NodaTime' to project 'Assembly-CSharp.csproj'. The project does not support adding package references through the add package command.

I am using Unity 2021.3, IL2CPP as backend, and tried both .NET Framework and .NET Standard 2.1. I'd like to be able to build for iOS and Android targets.

What am I missing?

Fausto
  • 31
  • 3
  • You read through [this](https://stackoverflow.com/questions/53447595/nuget-packages-in-unity)? – mason Jan 31 '23 at 23:41
  • Thanks! I'll give that a try and report back – Fausto Feb 01 '23 at 01:35
  • Worked like a charm! - install NuGetForUnity - from the Unity Menu -> NuGet, search for NodaTime, and install Thank you all – Fausto Feb 02 '23 at 15:36
  • While my question is marked as [duplicate], I think it is easier to find with the keywords "install" "nodatime" and "unity" – Fausto Feb 02 '23 at 15:41
  • So? It's not like your question is going away. It's marked as a duplicate, and links to the original. If users find the original via your post, that's just fine. – mason Feb 02 '23 at 15:43

0 Answers0