Skip to content

Getting started

Gokhan Kurt edited this page Feb 7, 2021 · 3 revisions

UI in React Unity is developed in Javascript, like how a React or React Native application is developed. The UI part is a Node.js project that builds a single Javascript file for C# part to render.

The recommended project structure is having a react folder next to your Assets folder

/[Unity_Project_Root]
  ...
  /Assets
  /ProjectSettings
  /react
    ...
    /src
    /package.json
    /tsconfig.json

For best development experience, using Typescript and Visual Studio Code is strongly recommended. This package has Typescript types built-in and Intellisense will help you greatly when writing code.

Caveats

  • You can add npm packages to your project. However, packages depending on DOM or other platform-specific APIs will not work. For example, you can use react-motion but you cannot use react-spring because it depends on DOM. Rule of thumb is that if a package works on both React DOM and React Native, it will probably work on React Unity. react-router, react-motion and redux-toolkit are just some examples.