Godot version:
v3.0.rc3.official
OS/device including version:
Ubuntu 16.04
Issue description:
I'm using the canvas 2D drawing functions to create a texture and then using that texture on other nodes. Instancing a 2D scene that uses local viewport textures causes runtime errors in the Output and Debugger panes but the project still runs correctly. The errors are:
Node not found: Viewport
ViewportTexture: Path to node is invalid
The errors show in the Output pane when the parent scene is loaded and in the Debugger when the project runs. It makes testing tedious because I never know if the error in the Debugger is real or not.
I'm not sure if my node setup is correct for what I'm trying to accomplish but it works.
Steps to reproduce:
I've attached a project that repros the problem.
Minimal reproduction project:
node-not-found-example.zip
Just discovered that if the Viewport node is moved above the nodes that use its texture then the issue goes away. Not sure if it's a bug or not.
This issue is driving me nuts, too.
I have two viewports in my game that I use to display 3D UI:
When I close Godot and later load the scene again, I get this:
To fix it, I remove a character from the ViewportPath field, hit enter, then add the character back and hit enter.
Using the 'Assign' menu also results in Bug #16035:
After discussing this on Discord, @bojidar-bg recommended to set the ViewportTexture and SpatialMaterial to 'Local to Scene' (as mentioned in related issue #7998) and this seems to avoid the issue.
Just note that you might have to set any Materials, etc. in which it is used to 'Local to Scene' as well.
Setting Local to Scene doesn't prevent the issue for me. Only moving the Viewport node above the nodes that use its texture avoids it for me.
I have encountered similar errors.
When a viewport is added to a scene, the scene file gets a _viewport_path_
viewport_path = NodePath("Path/To/The/Viewport")
This _viewport_path_ is "set in stone". It doesn't update if you for example rename a node in that path, or moves the viewport in the scene tree.
And because we can change the path as we want in the editor but the actual path in the scene file doesn't change, we get:
Node not found: Viewport
ViewportTexture: Path to node is invalid
Manually updating the scene file with the new, correct path clears the errors.
I found that error is gone if I moved Viewport
node to above Sprite3D
node which uses ViewportTexture
Facing the same issue, but with normal Sprite
and the solution (move the Viewport
above the node that uses the ViewportTexture
) worked too.
I think this is related to the instancing order, the Sprite resource, ViewportTexture
, is trying to use a node that may not be instantiated yet, that maybe why it points this error just once. I also figured out that manually setting the ViewportTexture.viewport_path
through a script makes nothing but display this error:
0:00:01:0841 - Condition ' !vp ' is true. returned: Size2()
----------
Type:Error
Description:
Time: 0:00:01:0841
C Error: Condition ' !vp ' is true. returned: Size2()
C Source: scene\main\viewport.cpp:106
C Function: ViewportTexture::get_size
If you try to save a ViewportTexture
in disk and set it on the _ready
callback, you will get the above error, but if you set, the same .tres
ViewportTexture
saved in disk in the editor, you won't get this error.
Also, I think this error/logic messes with the root Viewport
as you can see in an issue reported to a game I made (https://github.com/pigdevstudio/bard-lesson/issues/9)
Viewport texture doesn't work/render at all for me. Trying to use 3d camera with viewport and then rendering to TextureRect to make a minimap.
This is an usability problem, I fixed it earlier today in 7c00f0599e56137523f2ec6669b980d11423e9a0 so it should be more obvious when you are doing something wrong. Closing.
I am still having this issue even if the viewport texture resource is local to scene on 01e24447a
Most helpful comment
Just discovered that if the Viewport node is moved above the nodes that use its texture then the issue goes away. Not sure if it's a bug or not.