Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot change scene with InkPlayer instantiated #83

Open
MonkaKokosowa opened this issue Mar 22, 2024 · 1 comment
Open

Cannot change scene with InkPlayer instantiated #83

MonkaKokosowa opened this issue Mar 22, 2024 · 1 comment

Comments

@MonkaKokosowa
Copy link

Describe the bug

It's not possible to change a scene via get_tree().change_scene_to_file() with InkPlayer instance in the active scene.
To Reproduce

  1. Run a scene with instantiated and loaded InkPlayer
  2. Change it to another one (it doesn't work with and without the inkplayer in the new scene).
  3. Crash

Expected behavior

Normal scene change, just like with any scene that doesn't have InkPlayer

Ink files

It happens with any .json ink file

Environment:

  • OS: MacOS 14.2.1
  • Godot version: 4.2.1 vanilla
  • Inklecate version:
  • inkgd version: 0.6.0

Additional context

The exact issue is caused by line 838 in ink_player.gd with error Invalid get index 'root' (on base: 'null instance').

Also, I noticed that if I just comment that line out, there's no errors and the scene changes, though I don't know exactly if something else breaks in the back that I don't know about.

@lilrooness
Copy link

lilrooness commented May 26, 2024

Adding details to this

_remove_runtime calls get_tree().root which should be while the InkPlayer node is in the tree.

It looks like what is happening is that _remove_runtime is getting called from the _exit_tree function, which should be fine, except that the call to _remove_runtime is deferred, meaning it happens after the node has been removed, I'm not sure what the intent of deferring is, but I'll experiment with removing it. Currently using this plugin for game, so I have an interest in fixing this.

See here: get_tree returns null when it's called on a node that isn't inside the tree.

func _exit_tree():
call_deferred("_remove_runtime")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants