From 03fda674299f6b2dbc104fe15b444e647055d1a9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tobias=20Sch=C3=B6ner?= <tobias.stonehead@gmail.com>
Date: Wed, 11 Jan 2023 18:02:25 +0100
Subject: [PATCH] fix: FactExplorer does not get destroyed on click inside

---
 Assets/Scripts/UI/FactExplorer/OpenFactExplorer.cs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Assets/Scripts/UI/FactExplorer/OpenFactExplorer.cs b/Assets/Scripts/UI/FactExplorer/OpenFactExplorer.cs
index 1407a602..8e50e2a1 100644
--- a/Assets/Scripts/UI/FactExplorer/OpenFactExplorer.cs
+++ b/Assets/Scripts/UI/FactExplorer/OpenFactExplorer.cs
@@ -13,9 +13,10 @@ public class OpenFactExplorer : MonoBehaviour, IPointerClickHandler
     public void OnPointerClick(PointerEventData eventData)
     {
         // TODO: add support for other input systems
-        Destroy(factExplorer != null ? factExplorer.gameObject : null);
         if (eventData.button == PointerEventData.InputButton.Right)
         {
+            Destroy(factExplorer != null ? factExplorer.gameObject : null);
+
             var parent = transform.GetComponentInParent<Canvas>().transform;
             var fact = transform.GetComponent<FactWrapper>().fact;
 
-- 
GitLab