neo icon indicating copy to clipboard operation
neo copied to clipboard

Unity Support

Open somniumwave opened this issue 3 years ago • 8 comments

Hello,

I would like to discuss a way for Unity to interface directly with the N3 blockchain, i.e. invoke contracts from within. Currently there is a Unity SDK package that you can import and use pretty easily to get stuff like NFTs to show up in game, etc. But it's for EVM. Would love if we could make something like this work for NEO. I think it would make it really helpful for others that wanna build games that interface with N3. Please see link below for the SDK reference.

Chainsafe SDK - https://gaming.chainsafe.io/

somniumwave avatar Oct 18 '22 18:10 somniumwave

Info on .NET support in Unity: https://docs.unity3d.com/Manual/overview-of-dot-net-in-unity.html

As per that doc, Unity recommends targeting .NET Standard 2.1. It appears there are additional limitations that stem from Unity execution environment (Mono or IL2CPP)

devhawk avatar Oct 18 '22 22:10 devhawk

This appears related to #1865, where the refactored domain assembly (which I call "nucleus" but I am in no way married to that term) is unity compatible. @Liaojinghui proposed #2547, which was closed as a dupe of #1865.

This also appears related to https://github.com/neo-project/neo-modules/issues/749 which asks for a RpcClient that is compatible with .NET MAUI. I suspect that if we generate a "nucleus" assembly that is Unity compatible, it would be straightforward to build a RpcClient on top of it that was both Unity and MAUI compatible.

cc @erikzhang @shargon @gsmachado - Can we get some feedback on this?

devhawk avatar Oct 18 '22 22:10 devhawk

Well, as I expressed a couple of times, I'm a big fan of decoupling things (https://github.com/neo-project/neo/issues/1865) IF there's a reason for doing it.

IMHO, at this stage, it's desirable to decouple the code. It becomes way easier to make portions of Neo to be compatible with MAUI and Unity. We had some people asking for this in the past (including https://github.com/neo-project/neo-modules/issues/749), which justifies the decoupling (e.g., https://github.com/neo-project/neo/issues/1865). In other words: there's demand.

So, I'm on-board. 😄

@erikzhang @shargon: what do you think about this?

gsmachado avatar Oct 20 '22 17:10 gsmachado

It appears there are additional limitations that stem from Unity execution environment (Mono or IL2CPP)

Can we know what are incompatible?

shargon avatar Oct 20 '22 23:10 shargon

~This was closed by #499~

Ignore this comment.

devhawk avatar Dec 14 '22 23:12 devhawk

@devhawk by #499?

shargon avatar Jan 02 '23 21:01 shargon

@devhawk by https://github.com/neo-project/neo/pull/499?

I'm sorry, this issue should NOT be closed. https://github.com/neo-project/neo-vm/pull/499 was the first step towards unity compatibility. But there are two additional steps needed:

  • Break Neo.dll into two parts: the "Nucleus" and the stuff needed to run a full node. "Nucleus" will have the core domain model and will target .NET Standard 2.1 + .NET 6 just as Neo.VM does.
  • Update RpcClient to depend on the new neo nucleus assembly so that it can target .NET standard 2.1 (required for unity support)

devhawk avatar Jan 02 '23 21:01 devhawk

neo core is written in dotnet standard 2.1 now. Plugins however are not written in standard.

cschuchardt88 avatar Jul 02 '24 08:07 cschuchardt88