Godot Version
4.3 C#
Question
I asked this question 2 weeks ago, with no response. So I’m reposting it:
Basically, I have a loading screen that is used at the start of the game, to load the main menu first. Then, I click new game, using the loading screen again and once it’s loaded the first map its gone. No matter what I do, changing the WorldEnvironment on the camera, enabling SDFGI every frame, nothing makes it come back. What’s going on??
Global level changing code:
public void ChangeScene(String ToScene)
{
PackedLoadingScreen = (PackedScene)GD.Load("res://objects/LoadScreen.tscn");
InstanceLoadingScreen = (LoadingScreen)PackedLoadingScreen.Instantiate();
InstanceLoadingScreen.NextScene = ToScene;
TreeNode.CurrentScene.AddChild(InstanceLoadingScreen);
}
Loading screen code:
using Godot;
using System;
public partial class LoadingScreen : Control
{
[Export] public String NextScene { get; set; }
[Export] public Label LoadingText { get; set; }
private PackedScene NewScene;
private Global GlobalInstance = new();
private bool CompiledShaders = false;
public override void _Ready()
{
if (ResourceLoader.Exists(NextScene))
{
ResourceLoader.LoadThreadedRequest(NextScene);
}
}
public override void _Process(double delta)
{
switch (ResourceLoader.LoadThreadedGetStatus(NextScene))
{
case ResourceLoader.ThreadLoadStatus.Loaded:
if (CompiledShaders)
{
SetProcess(false);
NewScene = (PackedScene)ResourceLoader.LoadThreadedGet(NextScene);
GetTree().ChangeSceneToPacked(NewScene);
}
break;
case ResourceLoader.ThreadLoadStatus.Failed:
SetProcess(false);
GlobalInstance.ForceConsole(true);
break;
case ResourceLoader.ThreadLoadStatus.InvalidResource:
SetProcess(false);
GlobalInstance.ForceConsole(true);
QueueFree();
break;
default:
break;
}
}
public void ShadersCompiled()
{
CompiledShaders = true;
}
}