Unity adopting Net Standard libraries by default

Are you evaluating on adopting some of the following standard libraries? Are you tracking what Microsoft is doing? Do you know some of these libraries?

It would be a huge advantage if we could use some of these standard libraries in Unity. Why?

  • So we could bring our external developed libraries to Unity (without depending on UnityEngine like with “Debug.Log” that is a simple example but potential problem. Sometimes we have another c# project with a backend server that could share much code between that project and Unity.
  • Integrate better with third party libraries that could bring to Unity via nuget and “wire up” perfectly. Like I said, think of a library that uses ILogging interface of that Microsoft logging package.
  • Watch out with roadmap future features like: “Basic Player Localization” (https://unity3d.com/es/unity/roadmap). This must use IStringLocalizer and such of Localization package so we can integrate it better with other libraries please.

Also it would be a huge advantage to use the microsoft standard dependency injection library to use it inside Unity please. I know that we can import it ourself but I mean that Unity uses itself like asp net core “Startup” class works.

I know that some of them are huge changes but Unity needs to go in the right direction and don’t reinvent the wheel. Also it should go for SOLID:

It’s better for everyone and helps with TDD:

It’s a WIN-WIN for Unity itself (doing things better, QA…) and developers.

Note: Despite of being under “aspnet” versions targeting NET STANDARD 2.0 don’t have dependencies on “asp net core” packages.

4 Likes

I don’t have specific knowledge about any of these libraries. However, we are working closely with Microsoft and Xamarin. We’re working now on support for .Net Standard 2.0 in Unity, so all of these libraries should just work.

As to whether we can replace things like Debug.Log, I’m not sure. We’ll likely add support for these libraries first, then evaluate how they can be better integrated with Unity.

1 Like

Yes, that would be great. I guess adopting all these plus TPL, Rx and NuGet would significantly upgrade hmm… cultural background of Unity ecosystem.

Now when .NET Standard 2.0 is released, are there any estimates on when it is adopted by Unity?

For example in such scenario: targeting mobile platform in Unity (Android or iOS) I reference dll which is built outside of Unity as regular .netstandard2.0 assembly. More advanced scenario: some crypto or smth, that is not fully managed and requires some platform-specific support from target framework (which claims to support .NET Standard 2.0).

We’re still actively working on .NET Standard 2.0 support. I can’t say yet when it will land, but we want to get it out as soon as possible.

Our goal is to support any assembly built against .NET Standard 2.0 on all Unity platforms.

1 Like

Fantastic goal.

I’m curious how are you going to handle nuget package references. I dream one day on resolving them from visual studio.

Also, what about on my suggestions on adopting standard libraries? What about your localization feature? Or DI and IOC adopted by Unity?

1 Like

We’re still working out how nuget package references will work. We don’t have any plans now for syntonization from Visual Studio to Unity. I think we will just keep the one-way Unity to Visual Studio synchronization.

Since any library built against .NET standard 2.0 will work, these should as well. We’re not yet ready to switch to using this code as the standard practice in Unity though. That will require more time and thought to see if people use them and for us to get a better understanding of how they work.

Eagerly awaiting netstandard 2.0 support. Currently working on a game with a standalone server using .NET Core, so being able to share common libraries between Unity and the standalone server will be a huge boost. Hope this makes it into a beta build soon.

2 Likes

Any news on this @JoshPeterson ? It’s been half a year and we already have .NET Standard 2.0 in the current beta.

Are you thinking on using this basic standard libraries that are used across thousands of developers and that Microsoft work it’s built on top of this?

1 Like

I am unclear what you are asking for. You should be able to make use of .NET Standard libraries now starting in 2018.1.

Read my first post please and you should understand it.

I mean that:

  • If you have in the roadmap that you are going to make a runtime localization API you could use microsoft nuget package that exposes this already and build your API on top of that.
  • You can make Debug class implement microsoft nuget package for logging so we can reuse more code and wire up with other libraries on nuget.
  • You should go for SOLID design and implement microsoft dependency injection library and create and implement interfaces to apply inversion control and be more tdd and mock many tests.

In our case we have many projects that have a backend in ASP NET Core that we would like to share more and more code and if Unity adopts this Microsoft standard and lightweight libraries it would make life easier for us.

We are applying SOLID and TDD for our code base but we are facing many issues because of Unity’s design.

2 Likes

For what it’s worth I have a Unity client and .NET Core (not ASP.NET) server and am having no problems now sharing .NET Standard libraries between them. These are all libraries I’ve written though, nothing off the shelf.

1 Like

We don’t have this on the roadmap now. I wouldn’t rule it out in the future, but we’re not planning any large-scale changes like this to the Unity API at the moment.