inconsistent errors with preloading
Asked Answered
D

3

0

This problem only exists with exports.
I've been preloading lots of PNG files without a problem.
Today I added a bunch more and as far as I can tell the images are exactly the same (format) and imported the same but when I add these lines I get the error. 'Pendulum' is the last of a series of frames that have been importing fine.
The error has not been consistent; I modified the Fireplace_0 with the Pendulum png and of course it ran fine. When I ran it again with a different modification (that I can't remember) it ran fine, but then failed again. Given the huge cascade of failures at the cpp level it feels like a bug but don't see why the new images are so special. I even tried commenting out a bunch of other preloaded images in case it's a memory issue but that didn't work.

	'Pendulum_23':preload("res://N0307_NearBathroom/Pendulum/Pendulum_23.png"),
	'Fireplace_0':preload("res://N0306_CenterOfLivingRoom/Fireplace/Fireplace_050.png"),

I get this error:

D:\GodotProjects>
Godot Engine v3.5.3.stable.official.6c814135b - https://godotengine.org
OpenGL ES 3.0 Renderer: Intel(R) Iris(R) Xe Graphics
Async. shader compilation: OFF

ERROR: No loader found for resource: res://N0306_CenterOfLivingRoom/Fireplace/Fireplace_052.png.
   at: (core/io/resource_loader.cpp:278)
SCRIPT ERROR: Parse Error: Can't preload resource at path: res://N0306_CenterOfLivingRoom/Fireplace/Fireplace_052.png
          at: GDScript::load_byte_code (res://CommonScripts/g.gdc:293)
ERROR: Method failed. Returning: ERR_PARSE_ERROR
   at: load_byte_code (modules/gdscript/gdscript.cpp:782)
ERROR: Cannot load byte code from file 'res://CommonScripts/g.gdc'.
   at: (modules/gdscript/gdscript.cpp:2205)
ERROR: Failed loading resource: res://CommonScripts/g.gdc. Make sure resources have been imported by opening the project in the editor at least once.
   at: (core/io/resource_loader.cpp:270)
ERROR: res://global.tscn:3 - Parse Error: [ext_resource] referenced nonexistent resource at: res://CommonScripts/g.gd
   at: poll (scene/resources/resource_format_text.cpp:412)
ERROR: Failed to load resource 'res://global.tscn'.
   at: (core/io/resource_loader.cpp:206)
ERROR: Failed loading resource: res://global.tscn. Make sure resources have been imported by opening the project in the editor at least once.
   at: (core/io/resource_loader.cpp:270)
ERROR: Can't autoload: res://global.tscn
   at: (main/main.cpp:1912)
Determinant answered 5/3 at 5:45 Comment(0)
H
0

Determinant
Do you haven an import file for the Fireplace_052.png? It should be in the same folder as the png itself. If not, try deleting the file from the folder (I assume you have a backup of it somewhere else, if not, copy it to another folder outside of your Godot project first) and then adding it to the folder again. Normally Godot should automatically import all files it recognizes as possible assets in your project folder.

Also, in your preload, you load a file Fireplace_050.png, but the error is for a Fireplace_052.png ... maybe you have a typo somewhere or you are trying to reference a version of your graphic that is no longer there.

Heterosis answered 5/3 at 8:35 Comment(0)
D
0

Heterosis
Sorry for the mismatch, those Fireplace pngs would be the same.
I tried creating a png from scratch in a paint program (normall they from blender). No go.
I tried deleting the .import file for the _50 png. No go.
I tried deleting the entire .import folder then went for a nap.... No go.
I tried commenting out a large amount of preload statements in case it's a memory problem. No go.
The fact that I got it to work once and then it failed when I reran it means something is corrupted or the engine is grappling with something. I've run into problems before that mysteriously went away when I commented out the bad code and uncommented again.

Determinant answered 5/3 at 9:45 Comment(0)
D
0

Determinant
I fixed the problem. Although they are exactly the same no matter closely I look, the text I had for my preload path had an issue. I copied over it with a path copied from the Godot resource folder and it ran. Since I copied and pasted that first line a few dozen times, everyone of those lines had the same kind of corruption. I recopied them (and modified) all using the fixed line and now they all load fine.
There is something occult going on with the editor because this isn't the first time I've encountered something that seemed editor-centric. It's like there is more going on in the editor than just text-editing, since a text editor by definition can only store printable characters.
(I bet if I copied and pasted the bad lines into another editor then copied and pasted back, they would work! But...too late.)

Determinant answered 5/3 at 10:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.