Woody4618 / SolPlay_Unity_SDK

An SDK that lets you connect to phantom wallet, list NFTs, Swap Tokens, Unlock content with NFTs and interact with any anchor program. Build on top of the Garbles Unity SDK.
MIT License
44 stars 18 forks source link

Solana Unity Game Examples

SolPlay sdk is deprecated. Please use the https://github.com/magicblock-labs/Solana.Unity-SDK by magic block instead. You can find a working and up to data implementation of SolPlay sdk using wallet adapter and all the examples here: https://github.com/solana-developers/solana-game-starter-kits/tree/main/seven-seas/unity

A unity frame work build on top of the Solana Unity SDK with 4 example games.

Follow me on Twitter for more frequent updates: @SolPlay_jonas

1) To use it in your game just include in the Unity Package manager: https://github.com/garbles-labs/Solana.Unity-SDK.git#v0.0.6 in your unity package manager.

2) Import this unity package (Version 0.0.14 alpha) solplay_0_14.unitypackage.zip and then import it in Unity Assets->importPackage.

Some function may not work with the standart MainNet RPC. You may want to get a free RPC from quicknode or helius.xyz. Also currently its hard to get DevNet sol, so if the automatic airdrops fail you may need to try a few times, try different RPC in the WalletHolderService or transfer dev net sol to your Wallet or use solfaucet.com. (The publickey will be logged in the console on login)

3) Optional: Import Glftfast for 3D NFT support GlFAst Installer Also add the precompiler flag #GLTFAST

Here are the live versions for the example games:

All game examples work in WebGL using the Phantom browser extension and an mobile using phantom deeplinks. They all come with the Anchor code and Tiny Adventure one and two are also available as tutorials in the Solana Playground here: https://beta.solpg.io/tutorials/

Here is a Video which explains the process step by step: (A bit out dated, you can now skip the step 3) https://www.youtube.com/channel/UC517QSv61gMaABWIJ412_Lw/videos

Release notes: 0.0.13 Alpha

0.0.12 Alpha

0.0.9 Alpha

If you want to participate, it's very welcome.

Packages used:

Native WebSockets by Endel: https://github.com/endel/NativeWebSocket

WebSocketSharp: https://github.com/sta/websocket-sharp

Epic Toon FX: https://assetstore.unity.com/packages/vfx/particles/epic-toon-fx-57772

glTFast for runtime loading of 3D NFTs: https://github.com/atteneder/glTFast

Lunar console (Get the pro version here: https://github.com/SpaceMadness/lunar-unity-console Pro Version: https://assetstore.unity.com/packages/tools/gui/lunar-mobile-console-pro-43800)

Garbels unity solana sdk. Check out their awesome game as well! Vr Pokemon! https://github.com/garbles-dev/Solana.Unity/tree/master/src

Solanart: https://github.com/allartprotocol/unity-solana-wallet

Tweetnacl (removed): https://github.com/dchest/tweetnacl-js/blob/master/README.md#random-bytes-generation

Gif loading: https://github.com/3DI70R/Unity-GifDecoder

Flappy Bird Game: https://github.com/diegolrs/Flappy-Bird

Unity Ui Extensions: https://github.com/JohannesDeml/unity-ui-extensions.git

UniTask to be able to have delays in WebGL: https://github.com/Cysharp/UniTask/releases

Unity mainThread dispatcher to be able to call unity function from socket messages: https://github.com/PimDeWitte/UnityMainThreadDispatcher

Anchor to C# code generation https://github.com/garbles-labs/Solana.Unity.Anchor https://github.com/bmresearch/Solnet.Anchor/

So far the repository is only tested in IOS mobile, Android and WebGL.

Done:

Next up Todo: