Added reference wrapper type to wrap non-reference-counted objects in a reference.
This commit is contained in:
parent
28d74ab00d
commit
b317c1b17a
15
scripts/types/reference_wrapper.gd
Normal file
15
scripts/types/reference_wrapper.gd
Normal 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()
|
Loading…
x
Reference in New Issue
Block a user