#Button func _pressed() not called when clicked in dock

7 messages · Page 1 of 1 (latest)

fathom thunder
#

I've got a Button in a plugin dock scene. The button shows up fine in the dock, but when I click it, the _pressed() func isn't called. If I run the dock scene as a game, clicking the button does call the _pressed() func.

Here's the code:

Dock script:

@tool
class_name EbtDock extends EditorPlugin

var dock: Control

func _enter_tree() -> void:
    dock = preload("res://addons/ebt_dock/ebt_dock.tscn").instantiate()
    add_control_to_dock(EditorPlugin.DOCK_SLOT_RIGHT_UR, dock)


func _exit_tree() -> void:
    remove_control_from_docks(dock)
    dock.free()

Button script:

extends Button

func _pressed() -> void:
    print("hi")
ornate socket
#

Shouldnt you add the @tool keyword in the button script ?

fathom thunder
#

oh, maybe so! Since the scene was being instanciated by a @tool, I didn't think to add that to the rest, but that makes a lot of sense!

#

Hmm. _pressed() still seems to not be called when the button is clicked in the dock...

#

Oh, wait! I needed to restart the editor?

#

It's working now, thanks @ornate socket !

ornate socket
#

You need to reload the plug-in at least