LogicalError / realtime-CSG-for-unity

Realtime-CSG, CSG level editor for Unity
https://realtimecsg.com
MIT License
765 stars 81 forks source link

Applying material via drag-and-drop selects wrong surface #338

Open code-monkey-101 opened 2 years ago

code-monkey-101 commented 2 years ago

When you drag a material onto a surface, it seems to pick a different surface along the ray for every frame. So it's very hard to apply the material to the correct surface.

https://user-images.githubusercontent.com/32152103/155893393-f257285c-bd30-4779-a04f-70fce21d9173.mp4

LogicalError commented 2 years ago

Note to whomever fixes this; this probably has same or similar root issue as #331

alexjhetherington commented 2 years ago

Unable to replicate on 2019, 2021. @killerlegs could you share your unity version / realtimeCSG version, and if possible a scene that replicates this issue? Have a feeling it is something geo or material specific, or some exact steps I missed.

n.b. it reminds me of behaviour I saw before the imminent crash in this issue https://github.com/LogicalError/realtime-CSG-for-unity/issues/314

nukeandbeans commented 2 years ago

I have been able to reproduce (a similar issue) across multiple versions. When dragging a material from the project browser into the scene view, a ray is indeed casted every frame. This causes the model to invalidate, marking the scene dirty even if no changes were made. It is more noticeable if you have a scene with baked lighting of any kind (both realtime GI and baked). Having a ray only be cast when the mouse button is lifted (or alternatively only highlighting the surface) would probably work better here and avoid the issues mentioned.

nukeandbeans commented 2 years ago

As a side note, testing this, the undo stack get spammed with new undo states on a per-frame basis when dragging over surfaces.