Last active
August 29, 2015 14:17
-
-
Save Razzlegames/556df6340c97f3fd75f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#***************************************************************** | |
# In this game, there's a valid node called "Chair" | |
# - This will print "node isn't null" therefore verifying our | |
# assumptions that queue_free will not null the reference | |
# - You can even use the reference before this function is | |
# done executing (but don't do this in a real game) | |
func _ready(): | |
var node = get_node("Chair") | |
if(node != null): | |
# This will not null our reference. | |
# In fact we may still use the reference | |
# after queuing the free, as it is a delayed execution | |
# (not recommended though, as I am not sure if queue_free() is threaded) | |
node.queue_free() | |
if(node != null): | |
print("node isn't null!") | |
# This actually works! | |
print("node name is: "+ node.get_name()) | |
else: | |
print("node is null") | |
node = null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment