godot: NodePath cant be compared with null
Operating system or device, Godot version, GPU Model and driver (if graphics related): Linux, 3d06957f12ba5c04702f3db980af9c07142e7886
Issue description:
It’s impossible to compare NodePath with null. It will give Invalids operands 'NodePath' and 'Nil' in operator '=='.
error
Steps to reproduce:
- Create new scene.
- Add
Node
type to the scene root - Attach this script to the
Node
:
extends Node
var someNodePath = NodePath();
func _ready():
if(someNodePath == null): #Invalids operands 'NodePath' and 'Nil' (...)
pass
else:
print("it's ok");
- Run the scene
Update 1: From my bisection it seems that 137f8a5 is the first bad commit
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 17 (17 by maintainers)
Oh, but the comparison should return false instead of erroring, right.
It was done on purpose, however not adding the option back to booleanize the types was an oversight.