godot: Static func causes class to not get resolved on run

Godot version

v4.1.3.stable.official [f06b6836a]

System information

Godot v4.1.3.stable - Windows 10.0.19045 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 3080 (NVIDIA; 31.0.15.3640) - AMD Ryzen 5 5600X 6-Core Processor (12 Threads)

Issue description

I have classA which inherits from Node I have classB which inherits from classA

classA has static array classA has static function: static func(id : int) -> Node3D: return(array[id] as PackedScene).instantiate()

having this function defined, causes godot to crash with Could not resolve class “classB” whenever I define: var variable : ClassB in another script Removing either this typed variable from another script, or the function from the class, makes application run

Removing this typed variable, and then accessing the static func in classA via classA.func in runtime works.

I am not a very experienced developer, I hope the way I describe it make sense

Steps to reproduce

na

Minimal reproduction project

na

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Comments: 23 (9 by maintainers)

Most upvoted comments

Could you try making a copy of your project and start deleting stuff/checking if the issue persists until you get to the core of the issue with a bit of luck and a good deal of patience, then hopefully you can create a minimal project that reproduces the error. I have been able to successfully use this technique in the past to triage bugs

Funny how you have time to discuss that you do not have time

I am few days in already anyways, got it to work using load instead of preload. I’ll try to report properly if this happens again.

It’s understandable if you don’t want to share, but unless you provide a minimal project we can’t help and this will likely be closed

Could you try making a copy of your project and start deleting stuff/checking if the issue persists until you get to the core of the issue with a bit of luck and a good deal of patience, then hopefully you can create a minimal project that reproduces the error. I have been able to successfully use this technique in the past to triage bugs

I would have to keep in too much code which I’d rather keep private. I would really like to help figuring out what went wrong but cannot do this sorry

Thank you, I understand!

I just realized a weird coincidence my real class names and functions related to the issue are: ShipModels ShipModel

initShip() etc. What are the odds ?

It is people like you who keep Godot Engine awesome, I am sorry for being rude, I just found it ironic. And because I am an idiot, irony makes me laugh. I am also pretty depressed and whenever I feel something I have a tendency to share it.

Please accept this honest apology.

I understand, and it is not how I meant it. The recreated environment does not reproduce the error, therefore I would like to show it to someone knowledgable in real time. It is hard to tell if this is a rare editor bug or something else that I might have missed. I just want to show where exactly the problem is because I have no clue