ReactUnity / monorepo

Monorepo for React Unity development
1 stars 0 forks source link

monorepo initialization #1

Open ostryhub opened 2 days ago

ostryhub commented 2 days ago

Hello, this project looks very interesting from many perspectives. First the idea to use react and v8 for unity UI sounds very innovative and promising. Second the monorepo setup consolidating the web/ts/react stack with .net Unity C# is very intriguing.

Could you please shed more light on how to clone, initialize and work within the monorepo ? After cloning the repo and trying to init the submodules I get git errors about missing configuration for some submodules, in particular:

git submodule update --init --recursive fatal: No url found for submodule path 'samples' in .gitmodules

Thank you for starting such project and any info on the topic of the monorepo.

KurtGokhan commented 2 days ago

Hi. Thanks for your kind words.

This monorepo is for development of ReactUnity. If you are not planning to make changes to the ReactUnity source code, and only interested in using it, you are better off using the full-sample repo instead. Let me know if that is the case. I will also try to solve the error you mentioned.

ostryhub commented 2 days ago

Hi, Thanks for such a quick response.

I am interested in both using the ReactUnity within my project as well as understanding how this monorepo is set up as my project also is a compound of unity stack that under the hood uses clear script to run v8 engine. The JS/TS part of my app runs opencascade.js wasm module and unity side is used mostly for presentation layer. Yet I did not manage to make clear script integrated well enough to be able to use it in actual builds, it works in unity editor for me only atm (I am developing on m1 arm macbook).

So I am really blown away by how nice this monorepo setup looks like and I would like to learn how to use same structuring and tools to drive my project.

I am actively looking for a UI library for Unity that will ease the pain of managing UI in my app. ReactUnity looks VERY interesting to me for this particular job - declarative approach is THE way to go imho.

(My app is a CAD designer app that uses same codebase to run on web,desktop and XR goggles (Quest3). I am missing a nice UI solution that would allow me to quickly iterate over the UI/UX).

So if you could share what IDE and workspace setup you're using to develop ReactUnity I would love to learn from this. Also I think I can be good test case for how well ReactUnity integrates with other workflows like mine.

KurtGokhan commented 1 day ago

You can find all the binaries for ClearScript ready to use in Unity builds in this repo. I use this little program to collect all binaries for ClearScript whenever there is a new version.

But ClearScript won't work in IL2CPP platforms (mobile, iOS, or other il2cpp builds). That is why I use QuickJS as default in ReactUnity. You can find it here.

KurtGokhan commented 1 day ago

ReactUnity has a steep learning curve. Even if you know React or Unity well, there are nuances when using them together. Other than that, I think it can be a good library for non-game applications. In fact, I was doing a enterprise CAD application in Unity for a customer, and that is when I got the idea of ReactUnity. I couldn't use it in that application because ReactUnity wasn't ready back then, but if I was writing it today I would definitely use ReactUnity. I don't want to influence you much though.

ostryhub commented 1 day ago

Thank you for that info. I wasn't aware that IL2CPP won't work with ClearScript, knowing that I wont waste my time trying to make it work. When it comes to running v8 on android I am planning to play with https://github.com/LiquidPlayer/LiquidCore library as it mentions Android and iOS native support.

The QuickJS looks great as well but in my case it's lack of wasm support renders it useless in my particular case, still looks like very capable "little" library :)

When it comes to the monorepo, where does your particular setup originates from? Is this a thing from node.js ecosystem, some dedicated npm package or anything else maybe? (I am not a native fullstack/node/js/ts/web dev so those subjects are still a bit unclear to me).

And finally - I am going to try integrating ReactNative into my CAD app. I love how its just single UPM package. Yet this CAD app is not my main project so I will be trying to put it all together after working hours...

ostryhub commented 1 day ago

Also question about intended use of ReactUnity and UI scoping. In my app I am using multiple independent world canvases to display "independent screens" in world space. In the full-sample app I see single react app inside unity project. Is it possible to have multiple canvases in the same unity project displaying different "react apps" ? Would that require different react apps per screen or is it possible to have single react app source with multiple root components and have the components mapped to different unity world canvases ?

Thank you for the feedback.

KurtGokhan commented 1 day ago

The QuickJS looks great as well but in my case it's lack of wasm support

QuickJS itself can't run in WASM but my implementation works with WebGL build. That is how it works in our doc site.

Is it possible to have multiple canvases in the same unity project displaying different "react apps" ?

Yes, it is possible. You can render multiple react apps, multiple screen/world canvases in multiple scenes etc. You can either have multiple entry points in your React app, or use your React app as an SPA. There is too much flexibility and it is not possible to talk about all the options.

When it comes to the monorepo, where does your particular setup originates from?

It is a mix of git submodules and npm/yarn workspaces. I don't know if it is used elsewhere. But it has its drawbacks. I had previously opened an issue about it in the yarn repo.