Mark Sibly 7 years ago
parent
commit
c5a0a2d9f1
1 changed files with 13 additions and 13 deletions
  1. 13 13
      modules/mojo3d/scene/entity.monkey2

+ 13 - 13
modules/mojo3d/scene/entity.monkey2

@@ -328,14 +328,14 @@ Class Entity Extends DynamicObject
 			_children.Top.Destroy()
 		Wend
 		
-		_visible=False
-		
-		UpdateVisibility()
-		
 		For Local c:=Eachin _components
 			c.OnDestroy()
 		Next
 
+		_visible=False
+		
+		UpdateVisibility()
+		
 		If _parent
 			_parent._children.Remove( Self )
 		Else
@@ -551,27 +551,27 @@ Private
 	
 	Method UpdateVisibility()
 		
-		If _visible And (Not _parent Or _parent._rvisible)
-			
-			If _rvisible Return
+		Local rvisible:=_visible And (Not _parent Or _parent._rvisible)
+		
+		If rvisible=_rvisible Return
+		
+		_rvisible=rvisible
+		
+		If _rvisible
 			
-			_rvisible=True
-
 			OnShow()
 			
 			For Local c:=Eachin _components
+				
 				c.OnShow()
 			Next
 		
 		Else
 			
-			If Not _rvisible Return
-			
-			_rvisible=False
-			
 			OnHide()
 			
 			For Local c:=Eachin _components
+				
 				c.OnHide()
 			Next
 		Endif