Skip to content

Installation

Gökhan Kurt edited this page Mar 16, 2020 · 4 revisions

You can use quick start wizard by selecting React > Quick Start from Unity menu. After that, you can open [Unity_Project_Root]/react in Visual Studio Code or any other Typescript IDE to start editing your UI.

You can run npm run watch from this folder to automatically update the output whenever a file changes. By default this will create a file in [Unity_Project_Root]/Assets/Resources/react/index.js, which will be used by ReactUnity component to render the UI. ReactUnity component must be set-up with a Canvas to take effect.

Inspector setup

Optional Features

Some features are disabled by default for the sake of trimming down the build size. Following steps are optional and they are only needed if you are planning to use the corresponding features.

  • To use border-radius feature, com.unity.vectorgraphics module must be added.
  • REACT_FILE_API build flag must be defined to set script source to file.
  • REACT_WATCH_OUTSIDE_EDITOR and REACT_FILE_API build flags must be defined to use the watch feature. Only works in standalone and when the script source is file.
  • REACT_URL_API build flag must be defined to set script source to url.
Clone this wiki locally