godot: Custom class (`class_name`) not working with 3.2.3 RC3, but it works in RC2
Godot version: 3.2.3 RC3
OS/device including version: Windows 10
Issue description: I found some weird difference between RC2 and RC3 that I can’t figure out.
My HTML5 build crashes when a custom class is included, and complains “identifier “SafeNum” isn’t a valid type (not a script or class), or couldn’t be found on base “self”.”
The class DOES work in RC2 (and everything before that), so this must be a new bug.
Steps to reproduce: Just include my class file (that I pasted below), and use it like this: var diamonds:SafeNum = SafeNum.new(1)
Minimal reproduction project:
class_name SafeNum
extends Reference
var _num = null
var _permutator = null
var _permutation = null
class DynNum:
var _num:float
func _init(n):
_num = n
pass
func getValue():
return _num
func _init(n):
_setUnchecked(n)
pass
func _setUnchecked(n):
_num = DynNum.new(n)
_permutator = DynNum.new(randf()+1.0)
_permutation = DynNum.new(_num.getValue() * _permutator.getValue())
return self
func _setChecked(n):
if _permutation.getValue() != (_num.getValue() * _permutator.getValue()):
printerr("MEMORY CHEAT DETECTED")
return _setUnchecked(n)
func getValue():
_setChecked(_num.getValue())
return _num.getValue()
func setValue(n):
return _setChecked(n)
func plus(n):
return _setChecked(_num.getValue() + n)
func minus(n):
return _setChecked(_num.getValue() - n)
func multiply(n):
return _setChecked(_num.getValue() * n)
func divide(n):
return _setChecked(_num.getValue() / n)```
Bugsquad edit (keywords for easier searching): named class
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 16 (5 by maintainers)
Commits related to this issue
- Check if global class file still exists before registering it (cherry picked from commit e264ae20d2a828201a50868b3af334a3f8c8a37c) — committed to godotengine/godot by Rubonnek 4 years ago
Just came across this in Android and Windows. I use two scripts with
class_name
, I tried withextends Reference
and withoutextends
but its all the same, 3.2.2 RC2 works fine.