godotengine / godot

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

[dotnet] _Ready, _Process, etc don't fire on node created from external library classes. #76005

Open grumpOldman opened 1 year ago

grumpOldman commented 1 year ago

Godot version

4.0.2 stable

System information

Windows 10

Issue description

I was looking to split my project into different DLLs as the Godot Project compacts all scripts into one DLL. When project gets bigger the build times will get longer if everything is being compacted into one DLL.

Everything was going great I made separate Classlib with dotnet cli and add the reference to the Godot project, so far so good.

I then went to create a Node3D script in the newly created library with _Ready and _Process, but once I instantiated the new Class Object in a project script and added it to the SceneTree. _Ready and _Process wouldn't fire. I could manually call them in the attached project script. This doesn't seem like it should be doing this. Node3D node is created perfectly the functions/methods are not firing.

I did notice on the Test child node that the script field was empty probably due to it being from an external library (Classlib)

Steps to reproduce

Minimal reproduction project

TestSharp.zip

RedworkDE commented 1 year ago

See also #75301, will check the project later, but you probably get a message about a missing property and that a source generator has failec to emit code.

grumpOldman commented 1 year ago

I'm sorry for some reason errors weren't enable in my console so I didn't see them the first time.

  Failed to read file: '/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Godot.SourceGenerators.Internal/Godot.SourceGenerators.Internal.UnmanagedCallbacksGenerator/Godot.NativeInterop.NativeFuncs.generated.cs'.
  Cannot load C# script file '/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Godot.SourceGenerators.Internal/Godot.SourceGenerators.Internal.UnmanagedCallbacksGenerator/Godot.NativeInterop.NativeFuncs.generated.cs'.
  Failed loading resource: /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Godot.SourceGenerators.Internal/Godot.SourceGenerators.Internal.UnmanagedCallbacksGenerator/Godot.NativeInterop.NativeFuncs.generated.cs. Make sure resources have been imported by opening the project in the editor at least once.