#Replacing a corrupted scene?
1 messages · Page 1 of 1 (latest)
Might be an editor cache issue tho
you might be right, it still technically works when I run the game.. I just can't access it in the editor
Try deleting (or moving) the .godot folder from res:// while the editor is closed
that worked!!
@fast reef mind helping me figure out how to fix the issue that caused this in the first place?
I have an autoload singleton for global variables, which contains a dictionary of tile resources for when I need to instantiate any of them into my level
right now it only has the Wire resource which works perfectly fine
but when I try to add any more entries to this dictionary, the corresponding scene fails to load when I start the game
Are you sure tiles/Plug.tscn actually exists? The errors suggest it's not there at all.
it exists and works correctly if I remove line 25 🥲
Is there a tiles/TileBase that's broken? It's possibly trying to use that for Plug.tscn, failing, and erroring.
Could be a script error somewhere ye
my game is on a grid, so every object I have inherits from TileBase (including Wire.tscn) to handle grid movement/collisions. They all work correctly with no errors UNTIL I try to preload them in this script
except Wire, which for some reason works with the preload
And is the path for TileBase definitely correct? I'm sure I've had similar errors after reorganising the code.
ah
Cyclic imports perhaps?
nope, the path is correct
how would I know if this is the case?
I don't think it is
Open the plug scene once, then add it in script
Nah
- only WIRE in resource dictionary
- run game
- works
- open Plug.tscn in editor
- add line to script
- run game
- nope
I don't know how useful this would be, but I'm wondering if it would be worth posting the ext_resource section from the top of both Wire and Plug, just to see if there's any obvious differences. Tscn files can be opened in notepad, and then there's a section right at the top for the various resources.
Something like this
[ext_resource type="Script" path="res://scenes/world.gd" id="1_kpj12"]
[ext_resource type="TileSet" uid="uid://ccskplvx7ylud" path="res://tile_sets/tile_map_sf.tres" id="2_r1b3g"]
The first error it gives is a parse error, so it feels like the issue must be there.
wire
[ext_resource type="PackedScene" uid="uid://0kyy5eqd4w0w" path="res://tiles/TileBase.tscn" id="1_wbqma"]
[ext_resource type="Script" path="res://tiles/scripts/Wire.gd" id="2_bw8ks"]
[ext_resource type="Texture2D" uid="uid://c8kjhn6erfajc" path="res://sprites/wire-spritesheet.png" id="3_iemk0"]
plug
[ext_resource type="PackedScene" uid="uid://0kyy5eqd4w0w" path="res://tiles/TileBase.tscn" id="1_b1ncv"]
[ext_resource type="Texture2D" uid="uid://dthyr1b6ju1uk" path="res://sprites/plug-spritesheet.png" id="2_nppwc"]
[ext_resource type="Script" path="res://tiles/scripts/Plug.gd" id="2_ycywt"]
[ext_resource type="PackedScene" uid="uid://cemyt5t615e1w" path="res://tiles/components/MoveComponent.tscn" id="4_3avxy"]
Thanks.
(plug has a MoveComponent to respond to keyboard input by moving on the grid)
Does MoveComponent do any of its own loads or preloads?
only its own script
is it unusual that the id for TileBase is different between Wire and Plug?
I think that's normal, but I'll double check my own code.
Yeah, it's random per scene, so they won't match. It's the uid that it uses to work out which one it is, and that matches here.
Incidentally, does TileBase refer to MovementComponent at all? That could cause a cyclic dependency, like the one Ste mentioned.
it does
@onready var move_component: MoveComponent = get_node_or_null("MoveComponent")
Any chance of backing up the scene, removing the component, and commenting out the code using the component? Just to confirm whether the component is breaking it.
.. git commit time
Good call.
replaced the line with @onready var move_component = null, same errors
also let me check whether it works with other tiles that don't have a MoveComponent
Replace the preload with a load too, maybe?
it works with a load
which I guess is not a big deal, since I don't need to load that many resources
Huh. So it does sound like there's some sort of cycle somewhere. But as long as it works, I guess that's the main thing.
you think it's worth looking for the cycle? or is "if it works it works" good enough