I designed a script for the Sprite2d class that can apply multiple shaders at the same time, with an internal variable first_sub_viewport of the SubViewport type that references the first dynamically generated sub-viewport node. In order to show the effect in real time, this is a tool script and runs in the editor.
But there’s a problem with this variable being automatically saved when Godot is turned off. Then when you open it, you will get an error like "ERROR: Path to node is invalid: ‘EffectShow/ShadersSprite2D/@SubViewport@21740’.
”。
Correct! And my previous question was based on a misunderstanding. I mistakenly thought I had incorrectly saved a node, but it turned out the issue was with saving the viewport-texture. I had misdiagnosed the problem! Thank you so much for your answer! This is absolutely brilliant!