neo-project / neo

NEO Smart Economy
MIT License
3.47k stars 1.03k forks source link

Unity Support #2824

Open somniumwave opened 2 years ago

somniumwave commented 2 years ago

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/

devhawk commented 2 years ago

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 commented 2 years ago

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?

gsmachado commented 2 years ago

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?

shargon commented 2 years ago

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

Can we know what are incompatible?

devhawk commented 1 year ago

~This was closed by #499~

Ignore this comment.

shargon commented 1 year ago

@devhawk by #499?

devhawk commented 1 year ago

@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:

cschuchardt88 commented 4 months ago

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