godot: Using Viewport Texture causes "node not found" error / "Cannot get path of node as it is not in a scene tree"
Bugsquad note: This issue has been confirmed several times already. No need to confirm it further.
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.
- Open the project, open the main scene, and you should see the errors in the Output pane
- Run the project and you should see the errors in the Debugger pane
Minimal reproduction project: node-not-found-example.zip
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 5
- Comments: 29 (19 by maintainers)
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.
I found that error is gone if I moved
Viewport
node to aboveSprite3D
node which usesViewportTexture
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 managed to make the error disappear not by making
Viewport
a parent ofSprite3D
, but by makingViewport
a sibling that comes beforeSprite3D
on scene tree. One thing I was missing though is that you have to reassign ViewPortTexture onSprite3D
after the change.I don’t really know why, I’m kinda new on Godot 😄 But it did make the errors disappear
I am getting this sort of error message as well. What I have noticed is that the viewport texture seems to work fine when running the project in the editor, but on exported builds, the texture is garbled or pitch black depending on the graphics hardware I’ve tested on. Even if I made sure that the subviewport loads before my nodes using the texture in the hierarchy.
Doing this seems to get rid of the error message described above, but my ViewportTexture is still corrupted. UPDATE: Apparently the corruption only happens with the vulkan renderers. The GLES2 version reports errors but works just fine in builds. There’s probably some other funny business happening that causes the issue I’m seeing.
@Nekuromu 3.5.rc7 has a Label3D node, so you don’t need to use a Viewport anymore for that. It should be safe to upgrade now, but make sure to backup your project files before just in case.
same as prev comment: If you set viewport texture in editor it will show node not found. If you set viewport by code, like
var vwtex = ViewportTexture.new() vwtex.viewport_path = NodePath(‘%OffViewport’)
will show
E 0:00:07.821 get_height: Viewport Texture must be set to use it. <C++ Error> Condition “!vp” is true. Returned: 0 <C++ Source> scene/main/viewport.cpp:105 @ get_height()
Update:
I found as document says I should use
spr.texture = offvw.get_texture()
which works and no error outputI am still having this issue even if the viewport texture resource is local to scene on 01e24447a