Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #345 and #299 #346

Merged
merged 1 commit into from
Apr 14, 2022
Merged

Fix #345 and #299 #346

merged 1 commit into from
Apr 14, 2022

Conversation

nukeandbeans
Copy link
Collaborator

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

@nukeandbeans nukeandbeans merged commit 5c42716 into LogicalError:master Apr 14, 2022
@nukeandbeans nukeandbeans deleted the fix-domain-reload branch April 14, 2022 22:40
@andreiagmu
Copy link

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)

@nukeandbeans
Copy link
Collaborator Author

nukeandbeans commented Apr 16, 2022

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.

@nukeandbeans
Copy link
Collaborator Author

#350

@nukeandbeans
Copy link
Collaborator Author

nukeandbeans commented Apr 26, 2022

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

@Janooba
Copy link
Contributor

Janooba commented Jun 13, 2022

Confirmed fixed in #349 using 2019.4.31f1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compatibility with "disabled Domain Reload" MissingReferenceException
4 participants