Detecting When 3D View is Visible in Editor

Godot Version

v4.6.3

Question

Hi, I’ve made a 3D debug line renderer that is can be displayed both in-game and the editor.

But when I switch from the 3D view in the editor to the other windows the wireframe is still displayed:

Is there any way to detect in scripts when the 3D view is selected?

Sounds like you’re not using the proper methods to do 3D editor content, see this method instead

Thanks, that looks like the issue. I have to go through the tutorials on writing an editor plugin. I was using a normal Node2D and autoloading it as a singleton, which isn’t the right approach.