问题:

使用TextureRect显示SubViewport的内容,结果发生了如下报错

E 0:00:01:0007   get_node: Node not found: "SubViewport" (relative to "Node2D").
<C++ 错误> Method/function failed. Returning: nullptr
<C++ 源文件> scene/main/node.cpp:1364 @ get_node() E 0:00:01:0007 setup_local_to_scene: ViewportTexture: Path to node is invalid.
<C++ 错误> Condition "!vpn" is true.
<C++ 源文件> scene/main/viewport.cpp:76 @ setup_local_to_scene()

解决:

可以不用处理,这不影响使用。但是也有办法解决。



方法1:改变节点顺序。

使TextureRect节点在场景中的排序位于SubViewport节点之后。

缺点:这样似乎会引发不同的报错。



方法2:使用脚本设置TextureRect的参数

_Ready()中使用代码设置TextureRect的Texture属性为指定的ViewportTexture。

这样可以避免任何报错。

public partial class MyViewRect : TextureRect
{
[Export]
public SubViewport subViewport; public override void _Ready()
{
if (subViewport != null)
{
Texture = subViewport.GetTexture();
}
}
}

缺点:在可视化编辑器中无法方便地看到TextureRect的内容。



参考:

https://www.reddit.com/r/godot/comments/11s516p/comment/jccaoy5/

https://www.reddit.com/r/godot/comments/11s3m06/get_node_node_not_found_error_but_code_still/

https://github.com/godotengine/godot/issues/16067

Godot报错 Node not found: "SubViewport"[一问随笔]的更多相关文章

  1. 使用nvm安装node,运行node报错 node: command not found

    1. 使用nvm安装node之后,直接运行node命令会报错 node: command not found 需要使用nvm ls  查询一下当前使用的安装的node版本,然后使用node use 版 ...

  2. redis学习之集群报错Node is not empty

    遇到的问题及解决办法 在redis.conf里bind 真机ip后,接着重新执行每个redis.conf,最后再创建集群,但报错,如下图所示: 图中报的错即: [ERR] Node 192.168.1 ...

  3. k8s安装flannel报错“node "master" pod cidr not assigned”

    一.在安装flannel网络插件后,发现pod: kube-flannel-ds 一直是CrashLoopBackOff 此报错是因为安装Kubeadm Init的时候,没有增加 --pod-netw ...

  4. node启动服务报错Node.js Error: Cannot find module express

    在node文件夹中(M:\express-test),执行 npm install express 在使用npm安装express时,报npm WARN saveError ENOENT: no su ...

  5. 报错---“node install.js”

    如图 解决方案: 目录中执行 npm install chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromed ...

  6. [转] node升级到8.0.0在vscode启动js执行文件报错

    由于升级node 到 8.0.0 版本 vscode 启动一直报错: `node --debug` and `node --debug-brk` are invalid. Please use `no ...

  7. mongoose报错:DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.

    mongoose报错:(node:15689) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes ...

  8. 编译PHP 报错:node.c: In function dom_canonicalization

    编译PHP 报错:node.c: In function dom_canonicalization  /opt/php-5.2.17/ext/dom/node.c:1953: error: deref ...

  9. node.js创建服务器报错

    创建nodeTest.js如下: var http = require('http'); http.createServer(function (request, response){ respons ...

  10. 解决关于jquery中$.get()方法总是报“HierarchyRequestError: Node cannot be inserted at the specified point in the hierarchy”错的方法

    解决关于jquery中$.get()方法总是报“HierarchyRequestError: Node cannot be inserted at the specified point in the ...

随机推荐

  1. opengl编程天天踩的坑

    1. VBO 的 target 是 GL_ARRAY_BUFFER 不是  GL_VERTEX_BUFFER 2. glUniform()用来给uniform传变量 别用成 glProgramUnif ...

  2. win10自带录屏为什么录两个小时自动关闭?如何调节使其可以时间更长?

    Windows设置->游戏->屏幕截图->录制时间: https://www.zhihu.com/question/404390297

  3. unity 普通项目转URP项目

    1.导入UniversalRP (PackageManager 导入)2.创建Pipeline Asset     creat-->Rendering-->UniversalRender ...

  4. MYSQL DUAL(伪表)

    #DUAL是一个伪表,不存在的表. SELECT 8*9 FROM DUAL #输出72

  5. C#重点语法——特性

    特性的基本理解 ************************************************************************************* 一.含义 特 ...

  6. Java8 Optional使用方式

    参考博客:https://blog.csdn.net/zjhred/article/details/84976734

  7. Linux0.11源码学习(四)

    Linux0.11源码学习(四) linux0.11源码学习笔记 参考资料: https://github.com/sunym1993/flash-linux0.11-talk https://git ...

  8. ACM需要知道的STL小技巧

    天天用stl,但是有一些小技巧如果不知道,偶尔会导致TLE,这里说几个打比赛需要用到的. 主要是大概了解一下其底层原理:https://www.jianshu.com/p/834cc223bb57 就 ...

  9. Centos 7 配置Tomcat跳转Https

    前言:在网络安全盛行的时代下,有时业务为了安全需求要使用https协议,包括http.nginx.tomcat等,本篇简单分享一下tomcat跳转https配置. 1.环境 Centos 7.9 2. ...

  10. 聊天小精灵ChatGPT,好与不好大揭秘!

    一.引言 在一个遥远的地球上,有一个名为ChatGPT的魔法盒子,它能够用智慧回答你的问题,解决你的困扰.它是一个聪明的家伙,但和任何家伙一样,有优点也有缺点.现在就让我们一起来探索这个神秘的魔法盒子 ...