ReactUnity / core

React and HTML framework for Unity UI & UIToolkit
https://reactunity.github.io/
MIT License
733 stars 42 forks source link

Inconsistent element rendering #88

Closed noah-potter closed 1 year ago

noah-potter commented 1 year ago

On my machine, elements are not consistently being rendered. This only happens when the game is started. I've created a bare bones reproduction repo that includes some pics/vids and more detail:

https://github.com/noah-potter/ReactUnityStressTest

My current guess is that it has something to do with rendering a lot of elements at once. I've noticed the missing components are running their logic like normal, it's just that they never make it to the UI.

KurtGokhan commented 1 year ago

Interesting. I could observe the bug. It only happens in UI Toolkit renderer and not UGUI renderer.

Thank you very much for reporting. I will try to fix this soon.

KurtGokhan commented 1 year ago

Fixed this in main branch. Will release soon.

It was caused by elements getting collected by GC before they were rendered. So it could happen more frequently on devices with less memory. It didn't happen in UGUI because Unity holds a reference of elements in UGUI so they are not GCed.

KurtGokhan commented 1 year ago

Fixed in 0.15.2

noah-potter commented 1 year ago

Just confirming this fixed my issue. Thank you!