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

Removing and regenerating .godot folder breaks project while plugin is installed #554

Closed
BlairStewart opened this issue Apr 22, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@BlairStewart
Copy link

Describe the bug
If the .godot folder is removed and needs to be generated again. The plugin will enter a broken state which prevents the plugin from running and prevents any scene from being run.

Affected version

  • Dialogue Manager version: 2.38.0
  • Godot version: 4.2.1.stable.mono

To Reproduce

  1. Create new Godot Project
  2. Download Dialogue Manager Addon
  3. Create test.dialogue file
  4. Create Node2D Scene and save
  5. Attach script to Node2D scene
  6. Call test.dialogue file on first frame of _PhysicsProcess (Not strictly required but that is where I called it from)
    private Resource dialogue = GD.Load<Resource>("res://test.dialogue");
    private bool first = true;

    public override void _PhysicsProcess(double delta) {
        if (!first) return;
        
        DialogueManager.ShowExampleDialogueBalloon(dialogue, "this_is_a_node_title", new Array<Variant>() {this});
        first = false;
    }
  1. Save Project and close Godot
  2. Delete .godot folder
  3. Open project again.

Expected behavior
When the .godot folder is regenerated, the plugin should keep working.

Screenshots
When Godot first loads we get the following parse error messages:
38-39_(_) node_2d tscn - DialogueManTest - Godot Engine

When running the scene the following error stops the scene from loading:

Invalid call. Nonexistent function 'get_next_dialogue_line' in base 'Nil'.

Stackframes (Apparently Godot does not make it easy to copy these or I couldn't find it)

image

Also when running the scene the following errors show up in the Debugger:

E 0:00:01:0205   NativeCalls.cs:9004 @ Godot.GodotObject Godot.NativeCalls.godot_icall_3_981(nint, nint, string, string, int): Cannot open file 'res://.godot/imported/test.dialogue-c753d1c1c091aac077788a0b087c8b29.tres'.
  <C++ Error>    Condition "err != OK" is true. Returning: Ref<Resource>()
  <C++ Source>   scene/resources/resource_format_text.cpp:1643 @ load()
  <Stack Trace>  NativeCalls.cs:9004 @ Godot.GodotObject Godot.NativeCalls.godot_icall_3_981(nint, nint, string, string, int)
                 ResourceLoader.cs:100 @ Godot.Resource Godot.ResourceLoader.Load(string, string, Godot.ResourceLoader+CacheMode)
                 ResourceLoaderExtensions.cs:27 @ T Godot.ResourceLoader.Load<T>(string, string, Godot.ResourceLoader+CacheMode)
                 GD.cs:129 @ T Godot.GD.Load<T>(string)
                 Node2D.cs:9 @ DialogueManTest.Node2D..ctor()
                 :0 @ object System.RuntimeMethodHandle.InvokeMethod(object, System.Void**, System.Signature, bool)
                 :0 @ object System.Reflection.ConstructorInvoker.Invoke(object, System.IntPtr*, System.Reflection.BindingFlags)
                 :0 @ object System.Reflection.RuntimeConstructorInfo.Invoke(object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
                 :0 @ object System.Reflection.MethodBase.Invoke(object, System.Object[])
                 ScriptManagerBridge.cs:171 @ Godot.NativeInterop.godot_bool Godot.Bridge.ScriptManagerBridge.CreateManagedForGodotObjectScriptInstance(nint, nint, Godot.NativeInterop.godot_variant**, int)
E 0:00:01:0205   NativeCalls.cs:9004 @ Godot.GodotObject Godot.NativeCalls.godot_icall_3_981(nint, nint, string, string, int): Failed loading resource: res://.godot/imported/test.dialogue-c753d1c1c091aac077788a0b087c8b29.tres. Make sure resources have been imported by opening the project in the editor at least once.
  <C++ Error>    Condition "found" is true. Returning: Ref<Resource>()
  <C++ Source>   core/io/resource_loader.cpp:274 @ _load()
  <Stack Trace>  NativeCalls.cs:9004 @ Godot.GodotObject Godot.NativeCalls.godot_icall_3_981(nint, nint, string, string, int)
                 ResourceLoader.cs:100 @ Godot.Resource Godot.ResourceLoader.Load(string, string, Godot.ResourceLoader+CacheMode)
                 ResourceLoaderExtensions.cs:27 @ T Godot.ResourceLoader.Load<T>(string, string, Godot.ResourceLoader+CacheMode)
                 GD.cs:129 @ T Godot.GD.Load<T>(string)
                 Node2D.cs:9 @ DialogueManTest.Node2D..ctor()
                 :0 @ object System.RuntimeMethodHandle.InvokeMethod(object, System.Void**, System.Signature, bool)
                 :0 @ object System.Reflection.ConstructorInvoker.Invoke(object, System.IntPtr*, System.Reflection.BindingFlags)
                 :0 @ object System.Reflection.RuntimeConstructorInfo.Invoke(object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
                 :0 @ object System.Reflection.MethodBase.Invoke(object, System.Object[])
                 ScriptManagerBridge.cs:171 @ Godot.NativeInterop.godot_bool Godot.Bridge.ScriptManagerBridge.CreateManagedForGodotObjectScriptInstance(nint, nint, Godot.NativeInterop.godot_variant**, int)

E 0:00:01:0205   NativeCalls.cs:9004 @ Godot.GodotObject Godot.NativeCalls.godot_icall_3_981(nint, nint, string, string, int): Failed loading resource: res://test.dialogue. Make sure resources have been imported by opening the project in the editor at least once.
  <C++ Error>    Condition "found" is true. Returning: Ref<Resource>()
  <C++ Source>   core/io/resource_loader.cpp:274 @ _load()
  <Stack Trace>  NativeCalls.cs:9004 @ Godot.GodotObject Godot.NativeCalls.godot_icall_3_981(nint, nint, string, string, int)
                 ResourceLoader.cs:100 @ Godot.Resource Godot.ResourceLoader.Load(string, string, Godot.ResourceLoader+CacheMode)
                 ResourceLoaderExtensions.cs:27 @ T Godot.ResourceLoader.Load<T>(string, string, Godot.ResourceLoader+CacheMode)
                 GD.cs:129 @ T Godot.GD.Load<T>(string)
                 Node2D.cs:9 @ DialogueManTest.Node2D..ctor()
                 :0 @ object System.RuntimeMethodHandle.InvokeMethod(object, System.Void**, System.Signature, bool)
                 :0 @ object System.Reflection.ConstructorInvoker.Invoke(object, System.IntPtr*, System.Reflection.BindingFlags)
                 :0 @ object System.Reflection.RuntimeConstructorInfo.Invoke(object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
                 :0 @ object System.Reflection.MethodBase.Invoke(object, System.Object[])
                 ScriptManagerBridge.cs:171 @ Godot.NativeInterop.godot_bool Godot.Bridge.ScriptManagerBridge.CreateManagedForGodotObjectScriptInstance(nint, nint, Godot.NativeInterop.godot_variant**, int)
E 0:00:01:0205   NativeCalls.cs:9004 @ Godot.GodotObject Godot.NativeCalls.godot_icall_3_981(nint, nint, string, string, int): Error loading resource: 'res://test.dialogue'.
  <C++ Error>    Condition "err != OK" is true. Returning: ret
  <C++ Source>   core/core_bind.cpp:73 @ load()
  <Stack Trace>  NativeCalls.cs:9004 @ Godot.GodotObject Godot.NativeCalls.godot_icall_3_981(nint, nint, string, string, int)
                 ResourceLoader.cs:100 @ Godot.Resource Godot.ResourceLoader.Load(string, string, Godot.ResourceLoader+CacheMode)
                 ResourceLoaderExtensions.cs:27 @ T Godot.ResourceLoader.Load<T>(string, string, Godot.ResourceLoader+CacheMode)
                 GD.cs:129 @ T Godot.GD.Load<T>(string)
                 Node2D.cs:9 @ DialogueManTest.Node2D..ctor()
                 :0 @ object System.RuntimeMethodHandle.InvokeMethod(object, System.Void**, System.Signature, bool)
                 :0 @ object System.Reflection.ConstructorInvoker.Invoke(object, System.IntPtr*, System.Reflection.BindingFlags)
                 :0 @ object System.Reflection.RuntimeConstructorInfo.Invoke(object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
                 :0 @ object System.Reflection.MethodBase.Invoke(object, System.Object[])
                 ScriptManagerBridge.cs:171 @ Godot.NativeInterop.godot_bool Godot.Bridge.ScriptManagerBridge.CreateManagedForGodotObjectScriptInstance(nint, nint, Godot.NativeInterop.godot_variant**, int)

Workaround
I found a workaround that seems to get the project back to a working state.

  1. Open Project
  2. Go into Project Settings
  3. Plugin Settings
  4. Turn off Dialogue Manager
  5. Turn on Dialogue Manager
  6. Close Godot making sure to say Save and Quit
  7. Reopen the project
  8. Select any dialogue resource
  9. Go into Import settings
  10. Click Reimport
  11. Run scene
@BlairStewart BlairStewart added the bug Something isn't working label Apr 22, 2024
@nathanhoad
Copy link
Owner

That's an issue with how Godot does a clean load of the file system. Doing a second project reload always works for me whenever I need to empty the .godot cache.

@BlairStewart
Copy link
Author

Ah I see. It was not affecting my other plugins so I assumed (incorrectly) that it was a bug in how the plugin was registering itself.

Thanks for your time and quick response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants