Been having trouble instancing the next scene in my game during the fade-to-black transition.
public void animDone(string animName)
//Get the animation node again.
var animNode = GetNode("anim") as AnimationPlayer;
//Perform actions based on the completed animation.
//Emit the signal to let sceneManager know to swap scenes.
//Fade the screen back in.
//Grab global input again to renew player control.
var globalInput = (globalInput)GetNode("/root/globalInput");
//Allow player input again.
globalInput.allowCtrl = true;
All of the above works as it should. I've narrowed down the problem to the transitioned() loop.
public void transitioned()
var currScene = GetChild(0);
//Set the appropriate scene ID. This will be expanded later for additional screens.
if(sceneID == 0)
sceneID += 1;
//Remove the old scene.
//Load the new scene as an instance.
var loadScene = (PackedScene)ResourceLoader.Load(Convert.ToString(sceneDict[sceneID]));
//Be sure to set the right node type.
if(sceneID == 1)
Control newScene = (Control)loadScene.Instance();
Everything works fine until I get to the
Control newScene = (Control)loadScene.Instance(); line. That's when I encounter the above error and nothing I do seems to help. What can I do?
EDIT: Also, yes. The class in the script for the new scene is set to Control.