I am making a 2D shooter with Godot .mono and I have the following structure for my main scene and "player":
Node2D (main scene node)
|CanvasLayer
|TextureRect
|_KineticBody2D (player node)
The player scene instances a packed scene for my "bullet":
[Export]
public PackedScene PhaserBurst;
private AnimatedSprite _sprite;
public override void _Ready()
{
PhaserBurst = GD.Load<PackedScene>("res://Game/Weapons/MechProjectiles/IntroMech/IntroMechPhaserBurst.tscn");
_sprite = GetNode<AnimatedSprite>("IntroPlayerSprite");
var burst = (Area2D)PhaserBurst.Instance();
AddChild(burst);
}
When I run the player scene by itself, everything works perfect. However, when I run the main scene, which has the player as a child, everything works except the PackedScene being instanced. It's not just a matter of the position being off screen, printing to the console during the instantiation confirms that there is no PackedScene while running the main scene.
I've tried adding the instance as a child to every node in the parent scene tree, but no luck. Though I'm using c sharp, I would appreciate any input even for gdscript (I'm a .NET developer, so switching the syntax to c sharp hasn't been too difficult). I'm also very happy to add anymore context/code/screenshots needed to get me pointed in the right direction. I really appreciate any input!