Like this? Nothing changed, it crash
Changing scene from main menu to 3d game crashes
NazarK0
1 - you have 48 warnings
2 - what does it mean "it crash"? you have to be more specific. what level of crash are we talking about? does it return to the editor with an error (and if so what error)? does it core dump? does it stop working forcing you to ctrl+alt+del?
3 - please show a screenshot of the editor after running the game so we can see the hardware description in godot, or tell us what hardware you are running it on. you are on forward+ and that requires a modern computer with support for vulkan 1.1/1.3.
4 - it could also be the code.
you are connecting the signal in editor to a script in new game
.
try putting the script in Control
instead and connecting from there, and then doing queue_free()
instead of %Control.queue_free()
doing %
is equivalent to get_node()
.
the FileSystem is also missing level_1
somehow.
also, instantiate the level when the button is pressed, otherwise the level is kept in the background.
main_menu.gd
@export var level1 : PackedScene #set your level1 in inspector, the path will update if you move the file
func _on_pressed() -> void:
var new_game = level1.instantiate() #load the level
add_sibling(new_game) #add the new node parallel instead of as child
queue_free() #delete self, IE Control, containing the entire menu
Jesusemora
I handle all warnings, they are mostly by static typing. Right now only one warning remaining. I create new 3d menu, also load manager, nothing changed
Load manager script:
`extends Node
signal progress_changed(progress: float)
signal load_done
var _load_screen_path: String = "res://scenes/gui/loading_screen.tscn"
var load_screen: PackedScene = load(load_screen_path)
var _loaded_resource: PackedScene
var _scene_path: String
var _progress: Array = []
var _use_sub_threads: bool = true
func process(delta: float) -> void:
var load_status: ResourceLoader.ThreadLoadStatus = ResourceLoader.load_threaded_get_status(_scene_path, _progress)
match load_status:
ResourceLoader.ThreadLoadStatus.THREAD_LOAD_INVALID_RESOURCE, \
ResourceLoader.ThreadLoadStatus.THREAD_LOAD_FAILED:
set_process(false)
return
ResourceLoader.ThreadLoadStatus.THREAD_LOAD_IN_PROGRESS:
emit_signal("progress_changed", _progress[0])
ResourceLoader.ThreadLoadStatus.THREAD_LOAD_LOADED:
_loaded_resource = ResourceLoader.load_threaded_get(_scene_path)
emit_signal("progress_changed", _progress[0])
emit_signal("load_done")
get_tree().change_scene_to_packed(_loaded_resource)
func loadScene(scene_path: String) -> void:
_scene_path = scene_path
var new_loading_screen: LoadingScreen = _load_screen.instantiate()
get_tree().get_root().add_child(new_loading_screen)
self.progress_changed.connect(new_loading_screen._updateProgressBar)
self.load_done.connect(new_loading_screen._startOutroAnimation)
await Signal(new_loading_screen, "loading_screen_has_full_coverage")
startLoad()
func startLoad() -> void:
var state: Error = ResourceLoader.load_threaded_request(_scene_path, "", _use_sub_threads)
if state == OK:
set_process(true)
`
When I say
it crashes
I mean that when I press "new game" button" game just close, no errors, nothing. But when I separately run Level_1 scene it run, and play
- Edited
Sometimes it work as espected, but it is 1 to 100 approximately
progress bar go to 100% and game close
I change level_1 to new_game.tscn, nothing
I just create github repository for this game:https://github.com/NazarK0/3d-RPG-game
xyz The project has missing resources.
It's:
KayKit - Dungeon Pack
KayKit - Character Pack : Adventurers
KayKit - Character Pack : Skeletons
NazarK0 I just create github repository for this game:https://github.com/NazarK0/3d-RPG-game
But a bunch of errors and the game won't launch:
I update dependencies and push to repo
- Edited
- Best Answerset by NazarK0
NazarK0 Nothing crashes. The level loads normally just that it's fully obscured by your loading scene which is not getting removed. And that's because load_done
signal handler LoadingScreen::_startOutroAnimation()
gets stuck on first await
.
In general it's not a very good idea to await
form _process()
for multitude of reasons. So try to avoid doing that.
Btw one of the first thing you want to do for pleasant debugging is to implement runtime mouse capture toggle as well as set the game window to be on top (in editor settings), so you can navigate the editor debugging features while observing what happens in the game window.
When hunting for bugs, prints need to be placed (and removed) strategically, in order to gradually zero-in on the bug.
The project is still missing a resource: res://resources/meshes/assets/dungeon_texture.png
dungeon_texture.png
I added, but now this error:
Is the corner without a wall on purpose so it can fail?