Ok, so I just ran it in the terminal and in the editor, and here’s what the print statements returned:
When in the editor:
testing chunk
testing the chunk
not in cache yet
setting cache
when exported:
testing chunk
testing the chunk
not in cache yet
setting cache
WARNING: ‘res://scenes/chunks/0/chunk(-3,0).tscn’: In external resource #2, invalid UID: ‘uid://lbnmjcoai2px’ - using text path instead: ‘res://scenes/nav colliders/trees/basic_tree/basic_tree_large.tscn’.
at: open (core/io/resource_format_binary.cpp:1092)
WARNING: ‘res://scenes/chunks/0/chunk(-3,0).tscn’: In external resource #3, invalid UID: ‘uid://deu4ddmm6tf5f’ - using text path instead: ‘res://scenes/nav colliders/trees/basic_tree/basic_tree_mid.tscn’.
at: open (core/io/resource_format_binary.cpp:1092)
WARNING: ‘res://scenes/chunks/0/chunk(-3,0).tscn’: In external resource #5, invalid UID: ‘uid://djlw4hb37y1kh’ - using text path instead: ‘res://scenes/nav colliders/trees/basic_tree_berries/berry_tree_mid.tscn’.
at: open (core/io/resource_format_binary.cpp:1092)
WARNING: ‘res://scenes/chunks/0/chunk(-3,0).tscn’: In external resource #8, invalid UID: ‘uid://k41gp2pxlgto’ - using text path instead: ‘res://scenes/NPCs/new_dog.tscn’.
I added print statements in the following places: (-3, 0) is the only one that isn’t appearing:
func get_chunk_scene(path: String) -> PackedScene:
if "(-3,0)" in path:
print('testing the chunk')
if not chunk_scene_cache.has(path):
if "(-3,0)" in path:
print('not in cache yet')
if ResourceLoader.exists(path):
if "(-3,0)" in path:
print('setting cache')
chunk_scene_cache[path] = load(path)
else:
if "(-3,0)" in path:
print('doesnt exist, setting null')
chunk_scene_cache[path] = null
return chunk_scene_cache[path]
func load_single_chunk(coord: String) -> void:
var coords := string_to_vec2i(coord)
var save_path := _chunk_save_path(coords) # computed NOW, from current slot
if "_-3_0" in save_path:
print('testing chunk')
var scene_path := "res://scenes/chunks/" \
+ str(coords.y) \
+ "/chunk(" + str(coords.x) + "," + str(coords.y) + ").tscn"
var fallback := get_chunk_scene(scene_path)
if fallback == null:
if "_-3_0" in save_path:
print('fallback on -3, 0')
fallback = load("res://scenes/chunks/chunk(default).tscn")