Clone the ably-dotnet repo. and open unity folder.
- Git - VCS for ably-dotnet
- Unity - Unity game engine (Currently using LTS 2020.3.19f1)
- Unity script editor - Visual studio (Official IDE)/ Visual studio code (Editor)/ Rider (Intellij IDE)
- Basics of unity Official Unity Manual and Unity Beginner Manual
1. Git -
- Download and install git binary from https://git-scm.com/downloads
- Clone the code using
git clone https://github.com/ably/ably-dotnet
2. Unity -
- Install unity hub (https://unity3d.com/get-unity/download) to manage unity projects and different versions of unity
- Open unity hub after installation
- Unity projects -
- Unity projects are visible as a part of Unity Hub (list should be empty for none active projects)
- Please note, for each unity project, a specific unity version is specified, it can be changed by clicking on the visible version and selecting dropdown menu of installed unity versions.
- Install specific unity version -
- Click on the Installs menu-item from the left navigation bar to see the list of installed unity versions. In this image 2020.3.19f1 is installed, but the list will be empty if no versions are installed.
- Click the ADD button in the top-right corner to install a new version of unity.
- Select the most recent LTS version and click on NEXT to install the selected unity version.
- Once installed, it should appear under the
Installsmenu-item tab.
- Install unity modules -
- Unity modules are basically extra plugins to add build support for different platforms.
- Click on
⋮to open the menu for installing modules.
- Click on the
Add Modulesoption, to open the list of modules.
-
Select
Windows Build Support (IL2CPP)to add support for IL2CPP build support for Windows, then click onDONEto install the module. -
For more information related to Unity installation, please go through the official documentation for Installing Unity, Unity Editor tabs/Windows, Editor features and Visual Studio Unity integration.
3. Visual Studio -
- Visual studio community is free to use so it can be downloaded and installed using visual studio installer.
- Download the official visual studio installer from https://visualstudio.microsoft.com/downloads/.
- Visual Studio installer is used to manage different versions of Visual Studio along with the necessary plugins and individual components for each version of Visual Studio.
- Install and open the Visual Studio installer.
- Install Visual Studio
- There are two tabs visible. One shows
InstalledVisual Studio versions and the otherAvailableversions.
- If you have no versions installed, a new window will open showing visual studio components that need to be installed
- Under the 'Desktop and Mobile' header, click on
.NET desktop developmentand ensure the checklist on the right nav bar match up to the below image.
- Next, click on 'Game development with Unity' for unity editor scripting support.
- In the
Individual componentstab on the right nav bar select the following components.
- Finally, click the 'modify' button on the bottom-right to install visual studio with selected components.
- You can follow https://www.youtube.com/watch?v=FBo5Cso-ufE for a more detailed guide on setting up Visual Studio for Unity.
- Update/Repair/Modify installed visual studio
- If you need to change anything with Visual Studio, open the Visual Studio installer, where you should see the Visual Studio versions you have installed.
- Click on
Modifyon the version you wish to change the original component installation as below.
- Check the missing/broken components and click on
Modifyto install them again.
- After cloning this project, open the Unity Hub.
- Click on the
ADDbutton and open this project underably-dotnet\unity. - The default project layout should look as below:
- The default layout displayed has the test runner missing. For a more optimized layout for development, we have a custom Unity layout found under
ably-dotnet\unity\unity_editor_layout.wlt. - To apply our custom layout, you can click the selector named
Defaultin the top-right corner.
- Select
Load Layout From Fileand choose the fileably-dotnet\unity\unity_editor_layout.wlt. The new layout should look like this:
- We now have a test runner window in the bottom-left along with a user-friendly editor layout.
- In the bottom-left corner in the test runner window, click on the
EditModetab. - All tests should be available and shown under
EditMode.dll. - Double click on
EditMode.dllto run the tests or right-click andRunthe tests.
Unity.exe -batchmode -nographics -runTests -projectPath 'C:\Users\${UserName}\UnityProjects\ably-unity' -testResults editmode-results.xml -testPlatform editmode- In the bottom-left corner of the test runner window, click on the
PlayModetab. - All tests should be available and shown under
PlayMode.dll. - Double click on
PlayMode.dllto run the tests orright clickandRunthe tests.
Unity.exe -batchmode -nographics -runTests -projectPath 'C:\Users\${UserName}\UnityProjects\ably-unity' -testResults playmode-results.xml -testPlatform playmode- Right click on
Assetsunder theprojectwindow tab in the top-left corner. - Click on
Export Package->Exportto export the standalone unity package.
Unity.exe -batchmode -nographics -quit -projectPath 'C:\Users\${UserName}\UnityProjects\ably-unity' -exportPackage 'Assets' 'ably.unitypackage'- More information relating to Asset Package Export and Import can be found in https://docs.unity3d.com/Manual/AssetPackages.html.
- Currently, CI/CD for Unity projects are available using gameCI (open source tool), codemagic and unity cloud build.
- To use gameCI, follow the gameCI GitHub actions documentation.
- To use codemagic, follow the CI for Unity games using codemagic blog post and getting started with Unity codemagic documentation.
- Learn more about Unity Cloud Build here.
- Currently, the latest Ably source code is imported as DLLs in Unity using Unity Plug-ins.
- This is done as part of the release process by running
./unity-plugins-updater.sh 1.2.3(linux/mac) /.\unity-plugins-updater.cmd 1.2.3(windows) at the root. - This script is responsible for merging all dependencies into
IO.Ably.dlland copying it tounity/Assets/Ably/Plugins/.