/Engine/Source/Editor/UnrealEd/Public/EditorModeRegistry.h
Unregister your mode when it is no longer available like so (this will prompt the destruction of any existing modes of this type): /**
static [FEditorModeRegistry](API\Editor\UnrealEd\FEditorModeRegistry) & Get()