-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
_init issue for OOP #34365
Comments
I can't seem to reproduce it. If you don't provide a constructor for FSM_Test, it will inherit one. The code works perfectly for me (except that it complains about If you write your own constructor in the inheriting class, you pass the arguments like this: https://docs.godotengine.org/en/latest/getting_started/scripting/gdscript/gdscript_basics.html#class-constructor |
Try to reproduce with this one. Utils.gd - AutoLoad
Selectable.gd
|
Ok, this is weird. I don't see any significant difference from previous code, but this one doesn't work. |
thanks for testing dude, I think its because the Autoload (singleton) but its only a tought |
Utils is not a class (autoloaded elements are node instances) and you refer to the internal classes defined in the script (which should be loaded first and get a reference), if you name it with |
@eon-s I'll give a try, but if it is a node instance extending a node this code should work... |
No, it can't work because you are trying to access to class definitions via a node instance and not via the script. |
Aaand I just encountered the same issue, with a script inheriting a class defined with
where provided |
I can't reproduce anymore with the code in #34365 (comment) Can anyone still reproduce this bug in Godot 3.2.4 beta2 or any later release? |
@KoBeWi Tested here, no error |
So looks like it's resolved. |
Godot version:
3.2
OS/device including version:
ubuntu 18
Issue description:
` class FSM:
var manager = null
func _init(man):
manager = man
class FSM_Test extends FSM:
pass
func _on_ready():
var manager = "test"
var state = FSM_Test.new(manager) `
If you pass the manager arg the following error occurs:
Invalid call to function new Expected 0 args
if you does not pass the arg:
Too few arguments for _init() expected at least 1
The text was updated successfully, but these errors were encountered: