Quellcode durchsuchen

Fixed too many little issues, check the issues closed today.

Juan Linietsky vor 11 Jahren
Ursprung
Commit
f64f2d81ef
2 geänderte Dateien mit 5 neuen und 0 gelöschten Zeilen
  1. BIN
      3d/kinematic_char/level.scn
  2. 5 0
      misc/autoload/global.gd

BIN
3d/kinematic_char/level.scn


+ 5 - 0
misc/autoload/global.gd

@@ -9,6 +9,11 @@ func goto_scene(scene):
 	var s = ResourceLoader.load(scene)
 	#queue erasing old (don't use free because that scene is calling this method)
 	current_scene.queue_free()
+	# Remove the scene before loading the previous one.
+	# The node is removed when deleted anyway, but this will fix issues that 
+	# might arise if both have a root node with the same name,
+        # as adding both together will cause the second to be renamed. (not usually a problem, but you might be wanting to look for the node later and not find it)
+	get_scene().get_root().remove(current_scene)
 	#instance the new scene
 	current_scene = s.instance()
 	#add it to the active scene, as child of root