Development
Organization
Adding new functionality
To add a new render function you need three pieces:
Update
unitymouse/render.py
to include the new function and add documentationAdd the
socket.io
call to the set of calls inServer/server.js
Add the new functionality to the UnityClient in
UM_Client.cs
Before deploying you should add a new test script in Examples
which runs your new functionality and makes sure that it works. See example_script.py
.
Deploying the client
The client is accessed by users in two ways: either through the web server or through a standalone desktop app which we include in each minor version release. To deploy a new client you need to take a few steps.
If you changed the Addressable assets or updated to a new version of Unity you need to re-build the assets. Do this for each build target separately. Then copy the
UnityClient/ServerData
folder to thehtdocs/UMData
subfolder on the server.Build the WebGL target build, then copy this to the
htdocs/UMRenderer
subfolder on the server.Build the Windows target build, compress to zip, and attach this to the next release version. Or, if you are hotfixing a previous release, update the hotfix version number and swap the new build for the previous one.
Uploading to the server
The server runs Apache, the htdocs file is at C:/Apache24/htdocs
. Ask Dan for the login details. You can copy files locally onto the data server or copy them through google drive or slack.
Pushing the Pypi package
Confirm that the current renderer works
python setup.py sdist bdist_wheel
pip install -e .
pip uninstall unityneuro
Push to the test server
python setup.py sdist bdist_wheel
python -m twine upload --repository testpypi dist/*
pip install -i https://test.pypi.org/unityneuro/
pip uninstall unityneuro
Push to the real server
python setup.py sdist bdist_wheel
python -m twine upload dist/*
Deploying the server
For local testing
To run a local copy of the server you need to install Node.js and then run the command node server.js
in the Server folder. This will start the server on localhost:5000
. You then need to redirect both the python client and UnityClient to access the local server. Do this by running umr.setup(localhost=True)
and by checking the localhost
option in the main
GameObject.
On Heroku
Every time the github repository is pushed the Heroku server will re-build. You will get back a 503 server response if there are errors in the code running on Heroku.