You should place these files in a public directory within your project or use a CDN. Note that all of the URLs which can be provided to the Unity Config, including the ones mentioned above, are due to their enormous size not included into your bundle. The possibilities are endless, what's next is up to you! Simply rendering your Unity Application within your React Application is just the beginning! The Unity Context exposes a lot more fun functions and properties to play around with such as two way communication or requesting fullscreen or a pointerlock. To get you started, the most basic implementation should look something like this: You can find these in the quick start and advanced examples sections. The documentation consists of several examples, for both starting as well as more advanced users.
Looking for a new feature, but not sure where to start? Feel free to spin up a new discussion. Feel free to open a pull request to improve or add features to the any of these.
The source code of both the website and the module are contained within this mono-repo.
It however is recommended to update your project to a newer version of Unity in order to use all the latest features of React Unity WebGL. If you're using an older version of Unity, or you'll have to maintain a project built with an older version of the module, you can use one of the legacy versions of React Unity WebGL. Starting at version 9 of the module, support for builds made with Unity versions prior to 2020 are no longer supported. The web and Unity are evolving fast, to keep up with these changed the React Unity WebGL module has to adapt too while also keeping the module fast, lightweight and compatible.
% npm install react-unity-webgl Unity Version Compatibility If you are running into any issues, please consider opening an issue. When a new Unity version releases, I'll update the module as soon as possible in order to keep the compatibility up to date. Visit the installation documentation for more information.īefore installing the module, make sure you're installing a version which is compatible with your build's Unity version. If you don't have a React project yet, I recommend using Creat-React-App to get you started right away.
Get started by installing React Unity WebGL using the Node Package Manager or Yarn in your JavaScript or TypeScript React project.
Thanks for your time, happy coding! Installation If you are able to, I would appreciate it greatly if you would consider sending a donation or becoming a sponsor to help me keep this project going. React-Unity-WebGL will always remain free, but adding new features, maintaining it and keeping up-to-date with Unity's updates takes a lot of work and time. Maintaining and building this project is something I do in my spare time, and I have been doing so since 2017. The project you're looking at right now is one of my hobby projects. My name is Jeffrey Lanters, I'm a Unity and Web developer with a passion for Open Source. Hi there! I would like to say one more thing before you start bringing your awesome games to the web. React Unity WebGL provides a modern solution for embedding Unity WebGL builds in your React Application while providing advanced APIs for two way communication and interaction between Unity and React. Combining Unity with React is a great way to achieve these goals. When bringing your Unity Application to the web, you might need to communicate with Components on a webpage, build interactive interfaces or might want to implement functionality using Web APIs which Unity does not expose.