I have a scene that is no longer instantiating. It was working before but some recent change must have caused it to break… Here’s the code snippet where it gets hit:
And where the resource gets loaded (in a globally loaded script)
So my question is how tf am I suppose to diagnose the issue? Is there a warning log that would help or anything?? I’ve read before that it could be corrupted scenes but again, how do I diagnose that myself?
Ah yea, I should copy paste code snippets, thanks.
Well, a random shot in the dark of loading the scene within the function seemed to work… not sure why preloading the scene wouldnt work while loading does…
func NewWeapon() -> C_Weapon:
var weapon_scene : PackedScene = load("res://Game_Objects/Weapons/Weapons/C_Weapon.tscn")
var new_weapon : C_Weapon = weapon_scene.instantiate()
temp_node.add_child(new_weapon)
#var test = Resources.projectile.instantiate()
if weapon_scene.can_instantiate() == false:
printerr("RIP")
return new_weapon
I will look into printing what you said out of curiosity… I’m not really satisfied with this fix.
When loaded via preload it prints: <PackedScene#-9223371964343646838>
preload() inspector gives:
Pretty similar looking outputs- but load() is definitely working loading it as a PackedScene whereas preload is loading it as a generic object…? Bleh I have a feeling I should move on and not try to understand why preload is failing…