Unity Environment

This page contains getting started and how-to information for Bessy Unity developers (The github README.md files are public user documentation).

Setup

The Bessy Unity repository is structured as a Unity project. When opened in Unity, the a bunch of editor files will be added to the repository, but these are ignored by git. The main Bessy Unity code lives as an embedded package under Packages/com.bci4kids.bciessentials.

Note - At this time, Bessy Unity only supports Windows platforms. The LSL4Unity plugin doesn’t work correctly on macOS and Linux environments, see: https://bci4kids.atlassian.net/browse/B4K-123 for details.

TODO - what version of Unity? 2022.3 seems to work fine, but we previously specified 2021.3

  1. Install Unity
  2. Install VSCode
  3. Clone the Bessy Unity repository
  4. Open the repository in Unity as a project
  5. The package will appear in the Package Manager so you can install samples
  6. Unit tests in the package will automatically appear in Test Runner
  7. When changes are made to the code in the repository, Unity will automatically refresh.

Making Changes

The process for changing Bessy Unity code is essentially the same as Bessy Python. The main difference is a lack of an automated build that runs tests on the code. Developers are expected to manually run the unit tests prior to creating a PR. Reviewers should also run the unit tests as a second check.

TODO - try to get GameCI framework working for Windows, see findings here: https://bci4kids.atlassian.net/browse/B4K-130

Publishing Packages

The concept of packages is Unity is a bit different from other tech stacks. A “package” doesn’t have to be a single distributable file. Instead, “packages” are just a set of files and folders following a convention. The Unity Package Manager is able to install packages from a registry, GitHub or from the local disk.

We’ll be leveraging Unity’s ability to install from GitHub for now. That means consumers of Bessy install by providing Unity with a link to GitHub. Since the “package” lives at Package/bci.bci4kids.bciessentials, an additional path argument is needed. See the repo’s README.md for more information.

TODO - This style of publishing sucks because it’s hard to version the “package”. We need to look at proper publishing to a registry. There are alternatives we could consider, such as using a release branch or git subtree split repos, but that introduces process differences between Python and Unity development that we have to train / police.

TODO - Keeping track of “released” versions can be done by tagging the repository for now… That will work, but any user not wanting the bleeding edge will have to clone the repo, checkout a tag (or detached head), then install from disk.