Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
139 stars 2 forks source link

UIX: Indirectly deleting multiple RectSlotDrivers breaks Canvas #1803

Open mpmxyz opened 6 months ago

mpmxyz commented 6 months ago

Describe the bug?

Destroying multiple RectSlotDrivers via multiple DestroyProxy components can break Canvases. I haven't figured out the exact requirements on the UIX layouts but if they are fulfilled it is guaranteed to break. I noticed this after adding RectSlotDrivers to an existing project already using DestroyProxies.

To Reproduce

  1. Create a UIX hierarchy containing multiple RectSlotDrivers
  2. Create multiple DestroyProxies targeting all Slots in that hierarchy
  3. ??? (Not all UIX hierarchies trigger the bug.)
  4. Destroy all DestroyProxies at once

I have created an example: resrec:///U-TheAutopilot/R-e4229ae3-33ff-4e6f-95d3-a1dd24b3f1bf

Expected behavior

All affected slots should be destroyed and the Canvas be updated accordingly. In the given example that would mean that just the two buttons from the originally leftmost column would remain.

Screenshots

No response

Resonite Version Number

2024.4.18.1398

What Platforms does this occur on?

Windows

What headset if any do you use?

No response

Log Files

ANONYMOUS - 2024.4.18.1398 - 2024-04-21 21_47_40.log

Additional Context

I pressed F3 before and after the bug happened. The related exception is easy to find:

21:51:50.847 ( 60 FPS)  Exception when running synchronous action (Stage: UpdatingStreams):
System.NullReferenceException: Object reference not set to an instance of an object
  at FrooxEngine.ComponentBase`1[C].RunInUpdateScope (System.Action action) [0x0001f] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0 
  at FrooxEngine.UIX.RectSlotDriver.UpdatePosition () [0x00000] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0 
  at FrooxEngine.UIX.Canvas.FinishCanvasUpdate () [0x0005d] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0 
  at FrooxEngine.World.RunSynchronousActions () [0x0007b] in <d6ed7949e26c44a1ba2067ba3c2d6969>:0

Reporters

No response

shiftyscales commented 6 months ago

I haven't figured out the exact requirements on the UIX layouts but if they are fulfilled it is guaranteed to break.

Please spend some more time to try and find exact replication conditions that cause this issue. The easiest way would be simplifying your replication item by removing parts of it bit by bit until you get the simplest possible item that still exhibits the issue.

mpmxyz commented 6 months ago

I already spent hours simplifying but I gave it another go. You can't remove the following from the object:

It doesn't need multiple DestroyProxy-instances and the single instance also doesn't need to be directly embedded in a Slot with a RectTransform.

This is the url to the reduced object: resrec:///U-TheAutopilot/R-43375986-22db-408e-acd2-69212292b2a0

shiftyscales commented 6 months ago

Thanks for further simplifying it/narrowing it down further, @mpmxyz. Seeking input from @Frooxius when he has time to look into this- this issue has everything it needs as far as I can tell.