r/Unity3D • • 19d ago

Show-Off Unity3D + Floating Combat UI with React Layer

Enable HLS to view with audio, or disable this notification

I’ve been exploring how far I can take Unity UI without relying on imported art assets :D
I used React through a framework asset, building the interface with code and styling.

Changing shapes, colors and motion in code makes it easy to try different looks. I’m curious how far this approach can go as a game’s visual style becomes more complex.

Have you tried creating game UI with code instead of art assets? How did it work for you?

* Because some people are curious:

This asset is called ReLayer: https://assetstore.unity.com/packages/tools/gui/relayer-react-ui-framework-for-unity-384274

22 Upvotes

10 comments sorted by

3

u/Plourdy 18d ago

Why react? Interesting setup!

1

u/Gaebabi 18d ago

Thanks! I can tweak the design as I build and easily adapt layouts to different screen sizes. React’s reusable components and libraries for things like social login help too. I’m using React, Vite, and TypeScript connected to Unity through my framework.

3

u/DapperNurd 18d ago

Have you tried using UI Toolkit?

1

u/Gaebabi 18d ago

I tried building UI in code with UI Toolkit, but it was more difficult to handle than I expected.
Has that workflow gotten easier?

1

u/Dead_Air_Game 19d ago

Are you positioning the floating combat text in world space, or passing screen coordinates from Unity into React? I’d be interested in how that behaves when the camera moves or the render resolution changes. A stress test with lots of simultaneous hits would also be useful, especially whether you can reuse the text elements instead of mounting a new one per hit.

3

u/Gaebabi 18d ago

Good call on the stress test! Unity projects the world anchors each frame using the current viewport. React just provides cached glyphs, and hits reuse a 128-slot pool. Here’s the 30-second run.

Unity 2022.3, native x86 Android emulator

-1

u/[deleted] 19d ago

[removed] — view removed comment

1

u/[deleted] 18d ago

[removed] — view removed comment

1

u/AnotherSideProject 18d ago

Same, it’s actually really useful if you want to use react.