Browse Source

:beetle: Add script to track a node lifecycle

Was useful to debug the scene change.
DricomDragon 3 years ago
parent
commit
ede673e803
3 changed files with 23 additions and 2 deletions
  1. 17 0
      debug/TreeNotifier.gd
  2. 3 1
      labs/factory/Factory.tscn
  3. 3 1
      menu/Menu.tscn

+ 17 - 0
debug/TreeNotifier.gd

@@ -0,0 +1,17 @@
+extends Node
+
+
+func _init():
+	print(self, "_init")
+
+
+func _ready():
+	print(self, "_ready")
+
+
+func _enter_tree():
+	print(self, "_enter_tree")
+
+
+func _exit_tree():
+	print(self, "_exit_tree")

+ 3 - 1
labs/factory/Factory.tscn

@@ -1,8 +1,10 @@
-[gd_scene load_steps=2 format=2]
+[gd_scene load_steps=3 format=2]
 
 [ext_resource path="res://labs/factory/component/arena/tiny-gray-tiles.png" type="Texture" id=1]
+[ext_resource path="res://debug/TreeNotifier.gd" type="Script" id=2]
 
 [node name="Factory" type="Node2D"]
+script = ExtResource( 2 )
 
 [node name="Preview" type="Sprite" parent="."]
 texture = ExtResource( 1 )

+ 3 - 1
menu/Menu.tscn

@@ -1,4 +1,4 @@
-[gd_scene load_steps=9 format=2]
+[gd_scene load_steps=10 format=2]
 
 [ext_resource path="res://icon.png" type="Texture" id=1]
 [ext_resource path="res://labs/cascade/arena1.png" type="Texture" id=2]
@@ -8,10 +8,12 @@
 [ext_resource path="res://menu/button/start/StartButton.gd" type="Script" id=6]
 [ext_resource path="res://labs/cascade/Arena1.tscn" type="PackedScene" id=7]
 [ext_resource path="res://labs/factory/Factory.tscn" type="PackedScene" id=8]
+[ext_resource path="res://debug/TreeNotifier.gd" type="Script" id=9]
 
 [node name="Menu" type="Control"]
 anchor_right = 1.0
 anchor_bottom = 1.0
+script = ExtResource( 9 )
 __meta__ = {
 "_edit_use_anchors_": false
 }