How to use process function inside of plugin

Godot Version

Godot 4.5.1 stable

Question

So, I’m trying to make a map editor plugin for my Godot game, but I can’t figure out how to use the _process() function inside of my plugin, since _process seems to be disabled for scenes in plugins. My goal is to make a cursor that updates based on the mouse cursor, highlighting a tile that is currently selected. Is there some kind of equivalent function I should use?

All the scripts you want to run in editor must have the @tool tag, including your scene nodes or plugin nodes. You probably also want to add following snippet to avoid running code in editor for tool nodes:

if Engine.is_editor_hint(): return

Thank you!

Hope it helps. If you are curious about the whole process, you can take a look at docs:

Running code in the editor — Godot Engine (stable) documentation in English

You can also do the opposite and turn off that kind of intense processing in the game.

if not Engine.is_editor_hint():
    set_process(false)
1 Like