Added reference wrapper type to wrap non-reference-counted objects in a reference.

This commit is contained in:
Patrick 2021-08-18 22:11:13 +02:00
parent 28d74ab00d
commit b317c1b17a
Signed by: mewin
GPG Key ID: CEDB412C39B5BC47

View File

@ -0,0 +1,15 @@
# wrapps not reference-counted object in a reference
# useful for example if you want to store a type that extends Node outside of the tree
extends Reference
class_name GDB_ReferenceWrapper
var object : Object = null
#############
# overrides #
#############
func _notification(what : int) -> void:
if what == NOTIFICATION_PREDELETE && object != null:
object.free()