Godot报错 Node not found: "SubViewport"[一问随笔]
问题:
使用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"[一问随笔]的更多相关文章
- 使用nvm安装node,运行node报错 node: command not found
1. 使用nvm安装node之后,直接运行node命令会报错 node: command not found 需要使用nvm ls 查询一下当前使用的安装的node版本,然后使用node use 版 ...
- redis学习之集群报错Node is not empty
遇到的问题及解决办法 在redis.conf里bind 真机ip后,接着重新执行每个redis.conf,最后再创建集群,但报错,如下图所示: 图中报的错即: [ERR] Node 192.168.1 ...
- k8s安装flannel报错“node "master" pod cidr not assigned”
一.在安装flannel网络插件后,发现pod: kube-flannel-ds 一直是CrashLoopBackOff 此报错是因为安装Kubeadm Init的时候,没有增加 --pod-netw ...
- node启动服务报错Node.js Error: Cannot find module express
在node文件夹中(M:\express-test),执行 npm install express 在使用npm安装express时,报npm WARN saveError ENOENT: no su ...
- 报错---“node install.js”
如图 解决方案: 目录中执行 npm install chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromed ...
- [转] node升级到8.0.0在vscode启动js执行文件报错
由于升级node 到 8.0.0 版本 vscode 启动一直报错: `node --debug` and `node --debug-brk` are invalid. Please use `no ...
- mongoose报错:DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
mongoose报错:(node:15689) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes ...
- 编译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 ...
- node.js创建服务器报错
创建nodeTest.js如下: var http = require('http'); http.createServer(function (request, response){ respons ...
- 解决关于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 ...
随机推荐
- CMake制作我的第一个自己写的项目
首先写好CMakeList.txt ,然后把目标文件(.off格式)和 源文件(.cpp) 放在同一目录下吗,对该目录进行Cmake 生成build文件,打开.sln 文件,运行ALL_BUILD , ...
- 01 ansible的基本介绍
1.现有的企业服务器环境 在现在的企业中,特别是互联网公司,他们的业务量众多:比如负载均衡服务器.web服务器.动态解析(php)服务器.数据库(mysql)服务器以及网站缓存服务器,等等: 例如:一 ...
- 树莓派利用摄像头实现web在线监控
1.https://shumeipai.nxez.com/2021/10/21/raspberry-pi-usb-camera-to-realize-remote-network-monitoring ...
- jmeter之阶段式压测
一.bzm - Concurrency Thread Group 1.什么是阶梯式压测 阶梯式压测,就是对系统的压力呈现阶梯性增加的过程,每个阶段压力值都要增加一个数量值,最终达到一个预期值.然后保持 ...
- lnmp重新安装mysql
安装mysql好长时间,一直没去管,后来一直频繁重启,各种网上找方案去解决,最后问题太异常,一顿操作猛如虎之后把mysql彻底搞垮,无奈只能进行重装. whereis mysql mysql: /us ...
- nginx学习之路
nginx反向代理服务器 1.技术选型 nginx主要能实现的功能有负载均衡,反向代理,动静分离.选择nginx主要为了实现反向代理以及负载均衡功能, *为什么要实现反向代理 传统项目直接暴露在外网入 ...
- PointGNN未修改之前的结果 ---行人,骑行者
dl 18 23
- 对于Python中RawString的理解(引用)
对于Python中RawString的理解 总结 1.'''作用: 可以表示 "多行注释" ."多行字符串" ."其内的单双引号不转义" 2 ...
- LeetCode 周赛 336,多少人直接 CV?
本文已收录到 AndroidFamily,技术和职场问题,请关注公众号 [彭旭锐] 提问. 大家好,我是小彭. 今天早上是 LeetCode 第 336 场周赛,你参加了吗?这场周赛整体质量比较高,但 ...
- 【个人首测】百度文心一言 VS ChatGPT GPT-4
昨天我写了一篇文章GPT-4牛是牛,但这几天先别急,文中我测试了用GPT-4回答ChatGPT 3.5 和 Notion AI的问题,大家期待的图片输入也没有出现. 昨天下午百度发布了文心一言,对标C ...