Godot Version
4.2.2 stable
Question
Hello
I created a basic enemy who wait a random time between 2 values, then move in random direction, at fixed speed, and travels a random distance between 2 values.
For the waiting time and the distance, I use min and max variables with @export.
My problem is the distance value is always set to the default value, it never takes the values I set in the editor.
The enemy (slime) :
The enemy attached script :
It start in idle state :
When time is over, it switch to run state (actor is owner, so it’s slime node)
run state :
The values in the editor :
In the console I got this :
If I change speed in the parent, it also work fine like for the waiting time
I tried to change the variables names, to not set default, to move the variables into the parent, to let them and create new ones, to change type to float, to close and reopen slime scene and to restart godot, but nothing worked. If I change default values, it correcly takes the new default value, but never the values from the editor. So the enemy do what’s expected but if I want to change the distance I can’t do it from editor. Note I never had this issue with other exported var. For example the player I already made still work just fine.
If anyone can tell if I missed something or if it’s a bug (and in this case how to fix it)…
Thanks
EDIT : I just added on my player an @export var for the damage of the main attack and have the same problem. When I hit the enemy it decreases it’s HP from the default value, not the value set in the editor. I tried to redifine the damage value in the code, it works. So all my @export var I’ve created before slime’s distance max / distance min still works when I change the value in the editor, but the new ones don’t.