You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Realtime space x4 with procedurally generated galaxy.
Describe the problem or limitation you are having in your project
I noticed that it is faster to procedurally generate a game scene, while the scene is not in the tree.
So I generate the world out of tree and then add the main node to the tree.
get_tree().change_scene() and get_tree().change_scene_to() only accept PackedScenes, not nodes.
(or instanced PackedScenes, with nodes like sprites, etc. procedurally added to them)
Describe the feature / enhancement and how it helps to overcome the problem or limitation
solutions:
1
make get_tree().change_scene() and get_tree().change_scene_to() accept instanced PackedScenes instead of PackedScenes
2
add get_tree().change_scene_instance() and get_tree().change_scene_to_instance() methods.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
solution 1: get_tree().change_scene(newScene.instance()) instead of get_tree().change_scene(newScene) get_tree().change_scene_to(newScene.instance()) instead of get_tree().change_scene_to(newScene)
If this enhancement will not be used often, can it be worked around with a few lines of script?
Is there a reason why this should be core and not an add-on in the asset library?
Although there is an easy workaround, I think it could be beneficial for users and beginners, who generate their game world procedurally.
The change in solution 1 is only to add .instance() to the script to update your project to work.
edit:
If a scene is added to the tree, it always has to be instanced first, change_scene() seems to be the only exception
So for consistency I encourage solution 1.
The text was updated successfully, but these errors were encountered:
Describe the project you are working on
Realtime space x4 with procedurally generated galaxy.
Describe the problem or limitation you are having in your project
I noticed that it is faster to procedurally generate a game scene, while the scene is not in the tree.
So I generate the world out of tree and then add the main node to the tree.
get_tree().change_scene()
andget_tree().change_scene_to()
only accept PackedScenes, not nodes.(or instanced PackedScenes, with nodes like sprites, etc. procedurally added to them)
Describe the feature / enhancement and how it helps to overcome the problem or limitation
solutions:
1
make
get_tree().change_scene()
andget_tree().change_scene_to()
accept instanced PackedScenes instead of PackedScenes2
add
get_tree().change_scene_instance()
andget_tree().change_scene_to_instance()
methods.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
solution 1:
get_tree().change_scene(newScene.instance())
instead ofget_tree().change_scene(newScene)
get_tree().change_scene_to(newScene.instance())
instead ofget_tree().change_scene_to(newScene)
If this enhancement will not be used often, can it be worked around with a few lines of script?
add
onready var
andfunc
to Autoload "GLOBAL":use in script:
GLOBAL.change_scene(PackedScene.instance())
Is there a reason why this should be core and not an add-on in the asset library?
Although there is an easy workaround, I think it could be beneficial for users and beginners, who generate their game world procedurally.
The change in solution 1 is only to add
.instance()
to the script to update your project to work.edit:
If a scene is added to the tree, it always has to be instanced first,
change_scene()
seems to be the only exceptionSo for consistency I encourage solution 1.
The text was updated successfully, but these errors were encountered: