Open ParisRomane opened 2 years ago
Hmm... it seems like the DialogNode doesn't like to be outside of the tree after connecting to the viewport. Removing nodes from the tree without deleting them is a unusual move, so this has never happened in testing.
If you just want to delete the node do dialog.queue_free()
.
For pausing: have you considered using godot's pause system? I understand that might not work for your project tho.
It's unlikely we will make a fix, as we are putting most efforts into dialogic 2.0. Here are possible "hacky"-quick-fixes:
To make remove_child() not result in an error you could try adding if !is_inside_tree(): return
at the start of the resize_main() method. This might not work if other parts of the script assume they are inside the tree too.
if pausing only means not getting input (and thus not continuing) then you could modify the _input() method of the DialogNode.gd. E.g. if you have an autoload add a var dialog_paused = false
flag and check for that flag before collecting input. Now you can set that flag to disable input on the dialog node.
Thanks a lot for the answer ! Godot pause system doesn't really work as i want. Thanks a lot for the suggestions, they are really good ! I will try to create my pause fonction tomorow
I have followed your advice. I might not have done it in the cleanest way. If someone need the same feature this is what i have done : in dialog_node.gd i add ->
var paused = false
func set_paused(pause):
paused = pause
func get_paused():
return paused
func _input(event: InputEvent) -> void:
if paused :
return
[...]
in canvas_dialog_node.gd i add :
func set_paused(pause):
dialog_node.set_paused(pause)
if pause : # those line hide visually the dialog
dialog_node.hide()
else :
dialog_node.show()
func get_paused():
return dialog_node.get_paused()
Now i can have open a menu (or inventory) in the middle of a dialog. thanks again ! :+1:
This was completed.
Hello everyone ! I just tried dialogic for the first time a week ago, I love it.
My problem is : i want to be able to pause dialog and get back to it, without having to end dialog and play it back from the start. For example, i want to be able to open a menu or an inventory when we are in a middle of a dialog.
I have tried everything i can to pause dialog. Nothing works. I even tried to do it brutally, with remove_child(dialog) and add_child(dialog). That is when i find a bug i believe : remove_child(dialog) -> "Attempt to call 'get_visible_rect' in base 'null instance' on a null instance"
Describe the bug remove_child(dialog) make the game cash, with "Attempt to call 'get_visible_rect' in base 'null instance' on a null instance" in DialogNode.gd (also btw, is there a way to pause dialog ?)
To Reproduce Steps to reproduce the behavior:
Expected behavior I expected to just remove the dialog. but it's seems like it is still working. But it can't so it crash.
Screenshots the result of the crash :
System (please complete the following information):
Solutions
Workaround Nothing that i tried works to get the dialog to pause. We can end dialog and play it back from the start tho.
Possible fixes No idea yet.