Hi everyone, I started to study the GDscript.

I have a question and I can not find a complete answer to this question

I have root spatial

he has a child object MeshInstance (name - Clone)

MeshInstance has Spatialmaterial (name - carpet.material)

Spatialmaterial has a parameter Grow Amount (property name - params_grow_amount)

Root Spatial has a script

Script has a function func _on_Area_mouse_entered():

How do I get the parameter (params_grow_amount) in the root script to then change it in this function?

func _on_Area_mouse_entered():
	self.find_node("Clone").mesh.surface_get_material(0).set_grow(?.??)

Would find_node not be more expensive than defining the node name explicitly? i.e $Clone.mesh....?

@Bimbam said: Would find_node not be more expensive than defining the node name explicitly? i.e $Clone.mesh....?

It is a little more expensive than a direct get_node/$ call, but I do not think it is tremendously so. If you can, then using get_node is probably ideal, but there are cases where using find_node is the best tool for the job (like you do not know exactly what the path to the node will be).

I typically use find_node in my projects because it breaks less when I move nodes around. It's really easy for me to move something and forget its path was hard coded somewhere.

@"Dave The Dev" said:

func _on_Area_mouse_entered():
	self.find_node("Clone").mesh.surface_get_material(0).set_grow(?.??)

Everything is working! Thank you very much for your help. It is really a very convenient tool

3 years later