Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | lavaduder | |
Old Version | Published before Godot 3 was released. |
I’m trying to make a block’s color editable in the staticbody2d. Why? Because I’m exporting it to another scene. Where I can easily have multicolored blocks with one scene. instead of having to make a different scene color for each and every block.
However for some odd reason i get this message.
“Attempt to call function ‘set modulate’ in base ‘null instance’ on a null instance.”
I don’t understand why I am getting it. Since this isn’t calling a different scene.
Can someone please explain?
extends StaticBody2D
export var brickcolor = Color() setget brick_modulate
func brick_modulate(value):
brickcolor = value
get_node("block").set_modulate(brickcolor)
#block is a sprite node inside the StaticBody2D
Is there a child named “block”? (look at the remote inspector when error occurs)
get_node
is returning null.
eons | 2017-03-23 18:37