Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static Instance Preload Scene read corruption #81462

Open
Tracked by #80877
jlturner opened this issue Sep 8, 2023 · 2 comments
Open
Tracked by #80877

Static Instance Preload Scene read corruption #81462

jlturner opened this issue Sep 8, 2023 · 2 comments

Comments

@jlturner
Copy link

jlturner commented Sep 8, 2023

Godot version

v4.1.1.stable.official [bd6af8e]

System information

Godot v4.1.1.stable - macOS 13.5.1 - Vulkan (Compatibility) - AMD Radeon Pro 580X OpenGL Engine - Intel(R) Core(TM) i5-9600K CPU @ 3.70GHz (6 Threads)

Issue description

static_scene_corrupt.mov

static var scene: PackedScene = preload("res://example.tscn") in a script attached to a Node saved as example.tscn, when reloaded in Godot, makes the example.tscn file unable to be opened in Godot.

It does work when running your project however, and if that line is commented out in the script and the project reloaded, then the scene is editable again.

Steps to reproduce

Create the following files:

  1. example.gd:
extends Node

static var scene: PackedScene = preload("res://example.tscn")
  1. example.tscn: A scene with a Node root with the example.gd script attached.

Reproduce the error

  1. Click Project -> Reload Current Project
  2. Open example.tscn
  3. Observe error alert Scene file 'example.tscn' appears to be invalid/corrupt.
  4. Observe console output:
scene/resources/resource_format_text.cpp:283 - res://example.tscn:6 - Parse Error: 
  Failed loading resource: res://example.tscn. Make sure resources have been imported by opening the project in the editor at least once.
  scene/resources/packed_scene.cpp:92 - Condition "nc == 0" is true. Returning: nullptr
  editor/editor_data.cpp:880 - Index p_idx = 2 is out of bounds (edited_scene.size() = 2).
  editor/editor_data.cpp:683 - Index p_idx = 2 is out of bounds (edited_scene.size() = 2).
  editor/editor_data.cpp:745 - Index p_idx = 2 is out of bounds (edited_scene.size() = 2).

Minimal reproduction project

static_scene_bug_repro.zip

@dalexeev
Copy link
Member

dalexeev commented Sep 8, 2023

This is most likely a duplicate of one of #80877 tracked issues, but maybe there is some unique information. Please check #74253 (comment).

@jlturner
Copy link
Author

Btw for whomever ends up looking into this:

It seems to occur with any preload'ed scene in a static var initialization.
static var test = preload("res://example.tscn") does it for me

GradyTheDev added a commit to GradyTheDev/Terra4me that referenced this issue Sep 14, 2023
removed preloads from games autoloads.

Workaround for bug godotengine/godot#81462
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants