Hey everyone, I’m just getting started with the UI Toolkit. I used to communicate my EditorWindows with mono objects’ static instances in the scene in older Unity versions.
I’ve just created a custom overlay that has a bunch of EditorToolbarButtons and I want them to invoke an action event which the monobehaviour script listens to. Is communicating these scripts possible or creating scriptable objects/other stuff necessary?
Nothing specific should be necessary to access static instances. Every callback will run on the main thread, so no race condition would happen. The lifecycle may be different as the methods/callback will not be called at the exact same moment in the editor loop compared with IMGUI, but it should work.
Does something make you believed that you can’t?
@SimonDufour Thanks for the quick response. I ended up sending the event, it was my bad, not enough trying.
public ToolbarOverlay class has a bunch of static UnityActions and the EditorToolbarButtons in the toolbar invokes them on click and the MonoBehaviour class with the [ExecuteInEditMode] references to the actions and uses them.
1 Like