Closed nukeandbeans closed 2 years ago
Thanks! I noticed there's still a (minor?) issue with this version, but the main issue of the disappearing brushes is fixed.
When I open Play Mode (having selected a brush beforehand), and then exit and go back to the Unity editor, the behavior is different with and without Domain Reload.
Domain reload enabled: The editor selection from before is lost, the brush I selected before isn't selected anymore. I'm not sure if that's the intended behavior.
Domain reload disabled: The editor selection is kept, and my brush is still selected when I go back to Editor mode. But the console throws the following error:
NullReferenceException: Object reference not set to an instance of an object
InternalRealtimeCSG.MeshInstanceManager.UpdateHelperSurfaces () (at Library/PackageCache/com.prenominal.realtimecsg@a3ccdb6d13/Plugins/Editor/Scripts/Control/Managers/MeshInstanceManager.cs:413)
RealtimeCSG.SceneViewEventHandler.OnScene (UnityEditor.SceneView sceneView) (at Library/PackageCache/com.prenominal.realtimecsg@a3ccdb6d13/Plugins/Editor/Scripts/Control/Managers/SceneViewEventHandler.cs:60)
UnityEditor.SceneView.CallOnSceneGUI () (at <780782bc035845f9909cebbd4c983ae3>:0)
UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at <780782bc035845f9909cebbd4c983ae3>:0)
UnityEditor.SceneView.DoOnGUI () (at <780782bc035845f9909cebbd4c983ae3>:0)
UnityEditor.SceneView.OnSceneGUI () (at <780782bc035845f9909cebbd4c983ae3>:0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <f23cc42ed8af4b73afc7c74ab921aa08>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <f23cc42ed8af4b73afc7c74ab921aa08>:0)
UnityEngine.UIElements.IMGUIContainer.DoIMGUIRepaint () (at <f23cc42ed8af4b73afc7c74ab921aa08>:0)
UnityEngine.UIElements.UIR.RenderChainCommand.ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams drawParams, System.Single pixelsPerPoint, System.Exception& immediateException) (at <f23cc42ed8af4b73afc7c74ab921aa08>:0)
Rethrow as ImmediateModeException
UnityEngine.UIElements.UIR.RenderChain.Render () (at <f23cc42ed8af4b73afc7c74ab921aa08>:0)
UnityEngine.UIElements.UIRRepaintUpdater.Update () (at <f23cc42ed8af4b73afc7c74ab921aa08>:0)
UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <f23cc42ed8af4b73afc7c74ab921aa08>:0)
UnityEngine.UIElements.Panel.UpdateForRepaint () (at <f23cc42ed8af4b73afc7c74ab921aa08>:0)
UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at <f23cc42ed8af4b73afc7c74ab921aa08>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <f23cc42ed8af4b73afc7c74ab921aa08>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <f23cc42ed8af4b73afc7c74ab921aa08>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <f23cc42ed8af4b73afc7c74ab921aa08>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <f23cc42ed8af4b73afc7c74ab921aa08>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <f0d008a86f5e41eda07a8cec48955104>:0)
Domain reload disabled: The editor selection is kept, and my brush is still selected when I go back to Editor mode. But the console throws the following error:
I'll probably include a fix for this with the current PR #349, which will include bug fixes for a few other issues. For now, for others who may have this issue, you can just clear the selection at the top of the Clear()
method, like so:
#region Clear
#if UNITY_2019_4_OR_NEWER
[RuntimeInitializeOnLoadMethod( RuntimeInitializeLoadType.SubsystemRegistration )]
#endif
public static void Clear()
{
// add this here
Selection.activeObject = null;
BrushOutlineManager.ClearOutlines();
ClearRegistration();
ClearCaches();
_isHierarchyModified = true;
}
#endregion
which will make it behave as it did before support for domain reload options.
I'll go ahead and make an issue for this, so it can be mentioned.
Thanks! I noticed there's still a (minor?) issue with this version, but the main issue of the disappearing brushes is fixed.
When I open Play Mode (having selected a brush beforehand), and then exit and go back to the Unity editor, the behavior is different with and without Domain Reload.
Domain reload enabled: The editor selection from before is lost, the brush I selected before isn't selected anymore. I'm not sure if that's the intended behavior.
Domain reload disabled: The editor selection is kept, and my brush is still selected when I go back to Editor mode. But the console throws the following error:
NullReferenceException: Object reference not set to an instance of an object InternalRealtimeCSG.MeshInstanceManager.UpdateHelperSurfaces () (at Library/PackageCache/com.prenominal.realtimecsg@a3ccdb6d13/Plugins/Editor/Scripts/Control/Managers/MeshInstanceManager.cs:413)
This has been fixed with #349
Confirmed fixed in #349 using 2019.4.31f1
Domain reload was introduced with unity 2019.4, which would break projects with domain reload disabled. This PR adds the fix as mentioned by @andreiagmu.
Closes #345 Fixes #299