godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.24k stars 21.04k forks source link

"No loader found for resource: res://" when NativeScript has Script Class name #26275

Closed Lucrecious closed 5 years ago

Lucrecious commented 5 years ago

Godot version: 3.1 beta 5

OS/device including version: OSX

Issue description: I get spammed with the error as soon as I click "Add Node" and while I'm typing in the "Add Node" search.

I used lldb with VSCode to figure out where the No loader found for resource: res:// was coming from (it'd be cool to get some kind of hint as to "who" is trying to load this resource).

I found out that it's somehow coming from the NativeScript classes I have. As in, there's one No loader found ... for each .gdn I'm using. All .gdns have a non-empty class name, script name, valid library path, valid resource path to itself and a resource name under the inspector.

Here's an example of one of my .gdns:

[gd_resource type="NativeScript" load_steps=2 format=2]

[ext_resource path="res://bin/lutlib.gdnlib" type="GDNativeLibrary" id=1]

[resource]

resource_name = "CharacterAStar"
class_name = "CharacterAStar"
library = ExtResource( 1 )
script_class_name = "CharacterAStar"

Here's how the project.godot looks like for defining this global class name:

{
"base": "Reference",
"class": "CharacterAStar",
"language": "NativeScript",
"path": "res://src/lut/native/scripts/character_astar.gdns"
}

The spamming seems to really slow down the "Add Node" window.

Steps to reproduce:

  1. Create project with a NativeScript
  2. Give the NativeScript a Script Class name
  3. Right click any node in the Scene tab, and click Add Node
  4. Look at Output

This issue is similar to https://github.com/godotengine/godot/issues/22377

ericrybick commented 5 years ago

I found a solution for this spam. (check the commit above) However, when I checked the docs and the sourcecode, I wasn't able to really get an idea what "script_name_class" is used for. I think there should be a clearer explanation in the docs what it is used for. if I leave it blank for my gdnative scripts (c++) they still work.

If it is not necessary to further investigate this issue, let me know and I will create a pull request. image

Lucrecious commented 5 years ago

The script_class_name is like the class_name keyword, it allows me to make an alias for the path to the .gdn. My project breaks without it :p

Hopefully this gets pulled into a beta soon!

ericrybick commented 5 years ago

ah ok it's just an alias. Good to know! My fix should be sufficient then. :)

viniciusddrft commented 5 months ago

I'm having this error in godot 4.2.2