Skip to content

Commit b71a09f

Browse files
committed
fix: reset parentStack when not part of a viewStack
1 parent 1477204 commit b71a09f

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

Assets/PurrUI/Runtime/MonoView.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,17 @@ public class MonoView : MonoBehaviour
1212

1313
public CanvasGroup canvasGroup { get; private set; }
1414

15-
public ViewStack parentStack { get; private set; }
15+
public ViewStack parentStack { get; internal set; }
1616

1717
public bool cullWindowsBehind => _cullWindowsBehind;
1818

1919
public bool isTopMost => parentStack && parentStack.top == this;
2020

21+
/// <summary>
22+
/// Returns true if this view is currently part of a ViewStack.
23+
/// </summary>
24+
public bool isInStack => parentStack;
25+
2126
public Canvas canvas { get; private set; }
2227

2328
/// <summary>

Assets/PurrUI/Runtime/ViewStack.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ public void Pop(MonoView instance)
286286

287287
_stack.RemoveAt(idx);
288288
instance.OnPopped();
289+
instance.parentStack = null;
289290

290291
var transition = instance.ExitTransition();
291292
if (transition != null)
@@ -384,6 +385,7 @@ private void RemoveTop()
384385
var topView = _stack[^1];
385386
_stack.RemoveAt(_stack.Count - 1);
386387
topView.OnPopped();
388+
topView.parentStack = null;
387389

388390
var transition = topView.ExitTransition();
389391
if (transition != null)

0 commit comments

Comments
 (0)