-
Notifications
You must be signed in to change notification settings - Fork 888
Build as a Managed DLL
To build UniRX into a dll. I used Windows with Rider and Unity 2020.2.0a10 (installed via Unity Hub)
-
Clone UniRx from Github
-
Open the UniRx in Unity version.
Select your version of unity.
Double click it, click Confirm to upgrade the Project to a newer version of Unity. Note: This will take some time as the Package Manager fixes references/imports.
There may be some info/warnings that can be ignored.
If you open the scene in Assets\Plugins\UniRx\Examples Sample12Scene and run it, it should work. Typing in the text box will have a delayed output on a text label below it.
- Double click one of the Example .cs files to open your IDE e.g. Rider or Visual Studio.
Note: For Rider this is necessary as it installs to the current Unity Project based on the Editor it was opened from. If you simply open the solution in Rider it might load up with a previous version of Unity which is no good.
- Switch to Solution View
- Right Click Build Solution on the UniRx.
- If build is successful Dll's can now be found in UniRx\obj\Debug
- Now the UniRx.dll can be dragged into another Unity Project like you would with any asset, so long as it is the same version of Unity and same .Net version.
To test this I dragged the UniRx.dll into my assets pane in Unity.
Then I added a script to a game object and put this into the start method.
And added the csharp using UniRx;
namespace.
ObservableWWW.Get("https://google.com/")
.Subscribe(
x => Debug.Log(x.Substring(0, 100)), // onSuccess
ex => Debug.LogException(ex)); // onError
When I ran the game I saw HTML in the Console.
Note: I first tried opening the solution after cloning without opening in Unity first. This had thousands of errors as references/paths were all kinds of wrong. Open it in unity first and let the package manager work its magic...
This is probably a beginner mistake but worth noting as others who have not built a DLL for Unity for this project would probably run into it like I did...
Reference document is generated by neuecc/MarkdownGenerator