LogicalError / realtime-CSG-for-unity

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

Compatibility with "disabled Domain Reload" #345

Closed andreiagmu closed 2 years ago

andreiagmu commented 2 years ago

Considering my project has Domain Reload disabled, for faster Play Mode iteration: With the current version, if I add some CSG shapes in the scene, save the scene, enter Play Mode, then exit Play Mode. After returning to the Unity Editor, the CSG shapes vanish from the scene.

After adding the [RuntimeInitializeOnLoadMethod] attribute above the Clear() method from InternalCSGModelManager.Lifetime.cs, the issue is fixed.

#region Clear
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
public static void Clear()
nukeandbeans commented 2 years ago

Looking through issues, it appears like this is a problem that has occurred in the past, with issues #307 and #299. Fixing this should probably also fix those two issues.