How to get tool mode to work?

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

I’m trying to get a custom tool script to work. Code:

tool
extends Spatial

func _ready():
	set_process_input(true)
	print("START")

func _input(event):
	print("TEST 1")
	if event is InputEventMouseButton:
		print("TEST 2")
		var camera = get_parent().get_node("Camera")
		var ray_origin = camera.project_ray_origin(event.position)
		var ray_direction = camera.project_ray_normal(event.position)

		# Cast a ray
		var from = ray_origin
		var to = ray_origin + ray_direction * 1000.0
		var space_state = get_world().get_direct_space_state()
		var hit = space_state.intersect_ray(from, to)
	
		if hit.size() != 0:
			print(hit.collider)

I have added the script to a spatial node in the scene but no of the print methods print anything. What should I do to get it to work?