Changes that made by tool script resets after running scene

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Mehmet Ozbagci

I’m using a tool script which set scale of a node within a class object. It runs perfectly within editor but scale of that node (‘col_shape_node’) resets to (1,1,1) once I run scene. How can I make it permanent?

func _init():
      col_shape_node =

@export_range(1,10,1 )var terrain_collision_detail_level = 10:
	return terrain_collision_detail_level
		col_shape_node.set("scale" , 
		(Vector3(size.x/(img.get_width()/use_v),0,size.y/(img.get_height()/use_v))) + Vector3(0,1,0))

I think this is the case because they’re essentially the default properties of another node, not saved as part of the tool script/serialised by the editor. You’d have to take additional steps to save the collision resource, or perhaps have local properties that can be applied at runtime.

spaceyjase | 2023-04-19 14:14