godotengine / godot

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

Mono: Adding a autoload script outputs error in console "does not inherit a Node" #24949

Closed exts closed 4 years ago

exts commented 5 years ago

Godot version: 3.1 beta1

OS/device including version: Windows 10

Issue description: spits this error in the console when I add a script

 Script does not inherit a Node: res://Core/Game.cs
 editor/editor_autoload_settings.cpp:448 - Condition ' !info->node ' is true. Continuing..:

Steps to reproduce:

  1. Add a autoload script
  2. Look at error

Comments

Script still works, error is just spit out in console

ThumbCTRL.zip - just remove and readd the Core/Game.cs as an autoload script

akien-mga commented 5 years ago

I can confirm the issue on 3.1 beta 7.

Since the error doesn't seem to break the functionality, I'll move it to the next milestone.

neikeq commented 5 years ago

Does this happen if you build your project just before doing this?

akien-mga commented 5 years ago

Does this happen if you build your project just before doing this?

Indeed, if I build the project before adding the AutoLoad, there's no error.

neikeq commented 5 years ago

I will have to think what to do with this. The problem is that there is no way to check the validity of the script before building the project, so we can't check if it inherits Node.

exts commented 5 years ago

Couldn't you do the check after the build process and just error out during that process?

lobesoftllc commented 5 years ago

@akien-mga No script does not work on 3.1 as autoload if extends Node is not present. the autoload name is null at runtime, sometimes i don't see error on the console either.

Steps to reproduce:

Result: Script without the extends Node will not load

akien-mga commented 4 years ago

Seems fixed in 3.2 beta 5 Mono.

NovemberDev commented 4 years ago

I got this error using the latest 3.2 rc3...

akien-mga commented 4 years ago

@NovemberDev Please open a new issue with a project that triggers it. The project in the OP does not seem to trigger any issue in 3.2 RC 3.

neikeq commented 4 years ago

This is not fixed. It happens when you try to enable a plugin before building. After building you can enable it.

neikeq commented 4 years ago

But honestly I don't think there really is a fix for this. Any idea what you would expect to happen instead?

evan-boissonnot commented 3 years ago

I got this error when exporting to windows or html. in the console => "Script does not inherit a Node".

But my script inherits Node .... I'm using 3.2.3

Twyker commented 3 years ago

Same problem when exporting to web. I'm using GodotRx (which has the autoload script).

jonhermansen commented 3 years ago

Still seeing this when loading my project in 3.3.stable.mono.official

And my autoload class does extend Node class.

Calinou commented 3 years ago

Please continue the discussion there: https://github.com/godotengine/godot/issues/36787