问题:

使用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. COM调用 – VB、PB

    本文使用Delphi和C++创建CRC32的COM文件(Dll). VB: V9.0 PB: V8.0 Delphi创建的文件,提供给VB9调用:C++创建的文件,提供给PB8调用. 一.VB部分 C ...

  2. SQL Server 2014 启动时提示:无效的许可证数据,需要重新安装

    路径:C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE 双击运行DDConfigCA.exe后,Sql Server 20 ...

  3. JavaScript ES6 类和对象 简单记录

    一/*1.在ES6之前如果定义一个类?通过构造函数来定义一个类*/ function Person(myName, myAge) { // 实例属性 // this.name = "lnj& ...

  4. GO语言http请求方法,可以携带请求头Header与cookie

    1.目录 2.main.go package main import "fmt" import "demo/common/http" func main() { ...

  5. Unity_飞机大战记录总结

    记录步骤:win+R→PSR.exe 一.竖屏设置 分辨率设为9:16 二.主控脚本 添加一个空节点,命名"游戏主控" 新建游戏的主控脚本,命名为MyGame.cs,方便管理(即, ...

  6. java xml转为json的两种方法

    java xml转为json的两种方法 <?xml version="1.0" encoding="utf-8" ?><auibinsuran ...

  7. elementui中对样式的修改标签

    /deep/ .el-drawer.rtl { -webkit-animation: rtl-drawer-out .3s; animation: rtl-drawer-out .3s; backgr ...

  8. SAP transformation特殊字符

    unicode 0000 在transformation中总被翻译成,这个转义在其他语法中不存在,所以总是报错.

  9. win10试安装docker部署hyperf

    一:部署虚拟机,这里使用的win系统带的Hyper-V虚拟机,其它虚拟机也行 1.win+R打开命令行 2.安装Hyper-V . 失败放弃安装,选择其它吧 3.win10安装VMware 这里参考 ...

  10. [SUCTF 2019]EasySQL 1

    这个题目搞了我好久,由于本人基础不扎实,试了好多方法,只发现有三种情况 Nonono.无返回结果和有返回 然后使用了新学习的堆叠注入,得到了数据库名和表名 想要查看Flag表的字段内容也查看不了 这里 ...