Reputation: 1
I am curently trying to group some logic for my godot into class with static functions. For example I have a script like this :
extends Resource
class_name ExpManagement
enum ExpGrowthType {FAST, MEDIUM_FAST, MEDIUM_SLOW, SLOW, FLUCTUATING, ERRATIC}
static func exp_to_level(exp_points: int, growth_type: ExpGrowthType):
...
And in another script I call this function with ExpManagement.level_to_exp(exp_points, growth_type)
While doing so, the editor raises the error Static function "exp_to_level" not found in base "ExpManagement"
, which seems to mean that the code is unable to find my function in my class script.
I am using Godot 4.2.
I searched multiple articles online, including the documentation, but I couldn't find why.
The weird thing is, when I am running my scene, the script runs perfectly fine, no errors are raised, and the function is executed without problem. Does anyone know why the error shows up only in the editor and how to fix it ?
The class is not instantiated anywhere in the game, and I do not use any autoload or other fancy things.
Upvotes: 0
Views: 2339
Reputation: 11
This is definitely a cache issue: everything was fixed after restarting the engine
Upvotes: 0
Reputation: 40295
In my experience resaving the files (which might require making a change and undoing it) will make these kind of errors go away by making Godot parse the file again.
Upvotes: 0