Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Build as a Managed DLL

Liam Mitchell edited this page May 15, 2020 · 1 revision

To build UniRX into a dll. I used Windows with Rider and Unity 2020.2.0a10 (installed via Unity Hub)

  1. Clone UniRx from Github

  2. Open the UniRx in Unity version.

image

Select your version of unity.

image

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. image

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.

  1. 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.

  1. Switch to Solution View

image

  1. Right Click Build Solution on the UniRx.

image

  1. If build is successful Dll's can now be found in UniRx\obj\Debug

image

  1. 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.

image

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...