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

use ResourceLoader.LoadThreadedRequest in C# will cause some error #78034

Closed
gnenux opened this issue Jun 9, 2023 · 4 comments
Closed

use ResourceLoader.LoadThreadedRequest in C# will cause some error #78034

gnenux opened this issue Jun 9, 2023 · 4 comments

Comments

@gnenux
Copy link

gnenux commented Jun 9, 2023

Godot version

4.0.3.stable

System information

Windows11 Vulkan API 1.2.0 - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1080

Issue description

Hi, sorry fo my english.
I use ResourceLoader.LoadThreadedRequest to load some scene inherited from a scene with C# script, will print some error like this:

E 0:00:02:0048   Godot.NativeInterop.NativeFuncs.generated.cs:1535 @ void Godot.NativeInterop.NativeFuncs.godotsharp_pusherror(Godot.NativeInterop.godot_string& ): Cannot load script for type 'BaseScene'. Path: 'res://BaseScene.cs'.
  <C++ 源文件>      modules/mono/glue/runtime_interop.cpp:1303 @ godotsharp_pusherror()
  <栈追踪>          Godot.NativeInterop.NativeFuncs.generated.cs:1535 @ void Godot.NativeInterop.NativeFuncs.godotsharp_pusherror(Godot.NativeInterop.godot_string& )
                 GD.cs:351 @ void Godot.GD.PushError(System.String )
                 ScriptManagerBridge.cs:489 @ void Godot.Bridge.ScriptManagerBridge.GetOrLoadOrCreateScriptForType(System.Type , Godot.NativeInterop.godot_ref* )
                 ScriptManagerBridge.cs:748 @ void Godot.Bridge.ScriptManagerBridge.UpdateScriptClassInfo(IntPtr , Godot.NativeInterop.godot_bool* , Godot.NativeInterop.godot_array* , Godot.NativeInterop.godot_dictionary* , Godot.NativeInterop.godot_dictionary* , Godot.NativeInterop.godot_ref* )
                 Godot.NativeInterop.NativeFuncs.generated.cs:154 @ void Godot.NativeInterop.NativeFuncs.godotsharp_internal_reload_registered_script(IntPtr )
                 ScriptManagerBridge.cs:506 @ void Godot.Bridge.ScriptManagerBridge.CreateScriptBridgeForType(System.Type , Godot.NativeInterop.godot_ref* )
                 ScriptManagerBridge.cs:451 @ void Godot.Bridge.ScriptManagerBridge.GetOrCreateScriptBridgeForType(System.Type , Godot.NativeInterop.godot_ref* )
                 ScriptManagerBridge.cs:436 @ void Godot.Bridge.ScriptManagerBridge.GetOrCreateScriptBridgeForPath(Godot.NativeInterop.godot_string* , Godot.NativeInterop.godot_ref* )

Steps to reproduce

  1. BaseScene.tscn with BaseScene.cs
  2. ChildScene.tscn with ChildScene.cs, ChildScene.tscn inherited from BaseScene.tscn and ChildScene.cs inherited from BaseScene.cs
  3. use ResourceLoader.LoadThreadedRequest to load ChildScene.tscn

Minimal reproduction project

GodotTest.zip

@AThousandShips
Copy link
Member

Have you built your scripts?

@gnenux
Copy link
Author

gnenux commented Jun 9, 2023

Have you built your scripts?

yes, I built it

@lewiji
Copy link
Contributor

lewiji commented Jun 10, 2023

Can replicate here. Your demo project didn't seem to have the inherited scene/script mentioned, so I added those inherited from the BaseScene scene/script. Yes, I get the same error.

Edit: did note however that the scene seems to instantiate and execute the child script fine, despite the error about loading the parent script.

Setting useSubThreads to false in the threaded load parameters doesn't cause the error.

I think #74405 may fix this.

Edit: yes, Godot 4.1 beta 1 (which includes the above PR) doesn't error with useSubThreads set to true.

@gnenux
Copy link
Author

gnenux commented Jun 10, 2023

Can replicate here. Your demo project didn't seem to have the inherited scene/script mentioned, so I added those inherited from the BaseScene scene/script. Yes, I get the same error.

Edit: did note however that the scene seems to instantiate and execute the child script fine, despite the error about loading the parent script.

Setting useSubThreads to false in the threaded load parameters doesn't cause the error.

I think #74405 may fix this.

Edit: yes, Godot 4.1 beta 1 (which includes the above PR) doesn't error with useSubThreads set to true.

I test it in Godot 4.1 beta 1. Looks like there's no problem in first run, but the status by ResourceLoader.LoadThreadedGetStatus always in InProgress in rerun.

@gnenux gnenux closed this as completed Sep 9, 2024
@akien-mga akien-mga added this to the 4.1 milestone Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants