Skip to content

Conversation

@shubhank008
Copy link

@shubhank008 shubhank008 commented Jan 9, 2023

replaces RestSharp package with UnityWebRequests to make it Unity-oriented and compatible with all Unity platforms, specially WebGL.
RestSharp does not work in WebGL. Also replaces Task with UniTask as Task/Threading also is not WebGL compatible

Requires - https://github.com/Cysharp/UniTask
Requires (custom fork of UnityWebRequests) - https://github.com/GamerzDan/unity-web-requests

Need to add AsmDef references of both above packages to KineticSDK.asmdef
Tested in Unity 2021.3 with KinSDK rc12 in WebGL, PC, Editor

--Added on: 25-Jan-2023--
the current state of SDK will not work on CI due to DLL issues, so we had to replace the DLLs with their actual code bases to make it work
Obviously before reaching to this conclusion and solution, had tested to make the DLL work extensively including re-referencing the platforms, etc. but problem seems to be when the DLL were created/exported, they were not targeted/enabled for Linux system
So if you make a build using DLL on windows PC for Linux, it will work
But if you try to make a build using DLL on Linux for any platform (what CI does), it will not work as the DLL will not load

It involves:

1. Remove all DLLs from Packages folder
2. Add actual library codebase for all 3 packages (Solana.Unity.Core includes all the other Solana.Unity.* DLL codes)
3. Create Asmdef for all 3 packages and link their reference to the KineticSDK.def file in Runtime folder

GamezDanWork and others added 11 commits January 6, 2023 19:48
Add Asmdef link for UniTask in Kinetic.SDK
Add debug points for testing
Add DEFINES for Webgl Sync code and Async code for other platforms in KinSDK
Use Unity WebRequest interface - https://github.com/jeffreylanters/unity-web-requests
Add asmdef reference to UniTask and WebRequest asmdef files to KineticSDK

Modify ApiClient to WebRequest methods
Update AppApi to modified ApiClient
Create Helper method to convert string dictionary to query parameter string
Update ApiClient to use the query parameter string made from queryParams dictionary
Update Transaction API
Adding ContentType Json to APIClient API Call
Disable Debug Logs
Tested and working in WebGL
BouncyCastle bc-csharp
ChaosNacl
Solana.Unity.Core which includes Solana.Unity.Keystore Porgrams Rpc Wallet
Create Asmdef for all library packages and reference them to KineticSDK asmdef
@shubhank008 shubhank008 changed the title Replace RestSharp with UnityWebRequests wrapper to fix WebGL Replace RestSharp with UnityWebRequests wrapper to fix WebGL & Replace DLLs to fix CI Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant