问题:

使用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. CGAL的demo运行的步骤

    首先使用CMake,找到demo的源文件目录,并且指定生成文件目录: 点击configur,done 点击generate,done 找到build目录中的.sln 文件,打开 ALL_BUILD 生 ...

  2. 微信小程序 入门总结篇

      页面生命周期 Page({ /** * 页面的初始数据 */ data: { }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { }, ...

  3. Spyglass CDC工具使用(二)

    最近一直在搞CDC (clock domain crossing) 方面的事情,现在就CDC的一些知识点进行总结. 做CDC检查使用的是Spyglass工具.以下内容转载自:Spyglass检查之CD ...

  4. 《Unix/Linux系统编程》第九周学习笔记

    <Unix/Linux系统编程>第九周学习笔记 信号和中断 中断"是从I/O设备或协处理器发送到CPU的外部请求,它将CPU从正常执行转移 到中断处理.与发送给CPU的中断请求一 ...

  5. class3

    #include<stdio.h> #include<stdlib.h> #include<time.h> #include<windows.h> #d ...

  6. 实验二:Open vSwitch虚拟交换机实践

    基础要求提交 a) /home/用户名/学号/lab2/目录下执行ovs-vsctl show命令.以及p0和p1连通性测试的执行结果截图: b) /home/用户名/学号/lab2/目录下开启Min ...

  7. 微信小程序中如何上传和下载文件

    .wxml <button bindtap="chooseFile">选择文件</button> <view>请输入下载链接</view& ...

  8. RK3399编译——基于nanoPC-T4

    开发环境搭建 安装依赖 sudo apt install -y bison g++-multilib git gperf libxml2-utils make python-networkx zip ...

  9. Innodb的Buffer Pool

    什么是Buffer Pool 为了缓存磁盘中的页,MySQL服务器启动的时候就向操作系统申请了一片连续的内存,他们给这片内存起了个名,叫做Buffer Pool(中文名是缓冲池).innodb_buf ...

  10. 机器学习基础02DAY

    数据的特征预处理 单个特征 (1)归一化 归一化首先在特征(维度)非常多的时候,可以防止某一维或某几维对数据影响过大,也是为了把不同来源的数据统一到一个参考区间下,这样比较起来才有意义,其次可以程序可 ...