Hi,
I’m trying to figure out why, when I load a scene by itself that the _ready() method doesn’t run.
I don’t get any errors and just get the two messages about Godot Engine and GPU.
It’s undoubtly down to how I’ve set things up and would like to know if there was a way to use the debugger or other functions to find out why.
I have a Main Scene set in the project settings. The main scene consists of a tab container with each child node being a separate scene with a script attached.
When I run the current scene remote shows:
I wonder if it’s down to where I’ve attached the script? Should it be within the scene itself?
After doing some testing I believe it is down to where the script is attached being outside of the scene.
Would be good to confirm that’s exactly what needs doing for it work. It’s more around if I needed to modify the main scene code for the change in placement of the attached scripts or not.
The remote view never shows attached scripts, so if you don’t see it there it doesn’t mean it’s not attached (could be attached or not).
Could you share the script?
But yes, if you attached the script to Utils on the OpsDashboard scene, and you don’t have it attached on the Utils scene, if you execute the Utils scene alone the script won’t be called.
Which script has the _ready() function that isn’t running? If it’s the OpsDashboard one, the remote view suggests you are running the Utils scene and not the Main one, so it wouldn’t do.
Using the simple Test tab as an example. I had it like this:
using Godot;
using System;
public partial class TestMain : TextureRect
{
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
GD.Print("Current Scene:" + GetTree().CurrentScene.Name);
}
}
The attached script was attached under the main scene OpsDashboard
But going into the Test scene there wasn’t an attached script: