Can I restrict a MeshInstance3D to only show in one viewport?

Godot Version

4.2.2

Question

I’m writing an editor plugin and am adding a MeshInstance3D as a child of my plugin to display some user info. I’d like to have this mesh to only display in a single viewport. At the moment, if the user has a split 2 or 4 viewport view, the mesh will display in all of them.

Can I restrict the mesh to only draw in a specific viewport?

No you cant restrict the mesh. What you can do is restrict the rendering layers of the inherited VisualInstance3D of the mesh instance and match it with the Viewport.

This will only work for you and users that dont create custom Viewports since new Viewports render everything by default.

What you also can do is work with custom scenarios / world so the Viewport renders its entire own thing not being affected by all the others.

How would I set up a node tree so that it only rendered in a specific viewport?