extends Reference
can be useful for custom data types where you don't need any fancy functionality from a Godot node. It should be preferred over extends Object
as Reference will automatically manage its memory using reference counting.
If you use extends Object
, you have to manage memory manually by setting the variable to null
after you're done dealing with it. Otherwise, you'll leak memory.