问题:

使用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. CentOS7 进入修复模式的办法

    有时候配置Centos文件修改错误会导致系统无法登录,可以通过修复模式进行单用户运行模式,进行修复. 具体操作如下: 1.重启服务器,在选择内核界面使用上下箭头移动 2.选择内核并按"e&q ...

  2. 2020/03/23--Diary

    各位好! 我是R0ther,一位初学编程的学生.目前所学习到的有Java,C#,Winform,SQL-Server,H5,CSS3的一些基础知识,掌握一些Ae,Pr,Ps的基础应用. 虽然是大专文凭 ...

  3. centos安装k8s

    1.确保每台机器上有docker http://get.daocloud.io/#install-docker 2.关闭 每台机器上的swap,selinux swapoff -a setenforc ...

  4. vuw3学习大全(2)

    # composition(组合式api) ## 1.为什么使用composition vue3里面不需要Mixins了?因为有compoition api 能讲逻辑进行抽离和复用 大型组件中,其中* ...

  5. 使用虚拟 dom 渲染页面 《vue.js 设计与实现》

     使用 js 对象描述 ui 更加灵活.假如我们要根据级别不同采用不同的标签.js 对象描述的话,只需要一个变量代表 h 标签即可. // 当变量改变时,标签也会变化. let level = 3 c ...

  6. windows中使用jenkins部署项目,后端无法启动问题

    忙活一下午+一上午,问题终于解决了.找了各种办法,最终解决方式如下: 1.jenkins打包成功,到接口会报502异常 原因:后端未成功启动 解决办法: 1.刚开始使用shell命令,无法查杀进程,后 ...

  7. 12-如何使用Genarator逆向工程

    使用逆向工程,帮我们更快的建立pojo类.mapper接口及xml映射文件等,无需手写,替代了一部分的mybatis功能. 一.导入MyGenarator逆向工程项目 二.修改xml配置文件 三.执行 ...

  8. TProtocolException: Required field 'type' is unset! Struct:TPrimitiveTypeEntry(type:null)

    org.apache.thrift.protocol.TProtocolException: Required field 'type' is unset! Struct:TPrimitiveType ...

  9. linux查看mac地址

    1. ip addr show (ip address show .ip addr ) 查看本机ip和额外的一些信息 2.ifconfig -a  其中 HWaddr 就是mac地址 3.cat /s ...

  10. 使用float进行比较问题处理

    float compare Abstract 使用float数据进行精确计算和比较,可能由于精度问题导致程序逻辑异常. Explanation 使用float数据进行比较,计算机表达double和fl ...