Godot Version
Godot 4.X C#
Question
I’m starting the game, but the nodes (that is, the game objects) never appear in the 3D Editor section.
Godot 4.X C#
I’m starting the game, but the nodes (that is, the game objects) never appear in the 3D Editor section.
Your root node is 2D are you making a 2D game? That would explain why nodes don’t show in 3D. It may help if you do not blank out the scene tree so we can see what nodes you have contributing to the visuals.
Then they will not show in the 3D scene because they are not 3D, they will not show inside the editor because they are generated at runtime.
So there’s no way to make it visible? I want to develop a 2D game, but I can’t see it. My root node’s type is Node2D.
I think there’s a misunderstanding here; your title says “3D editor”, but everything you’re trying to do is 2D. I believe that’s why @gertkeno is asking about 3D.
Anything you generate at runtime will only be visible at runtime; if your window is empty until you start instantiating fish, the editor won’t show anything. You’ll only see in the editor what you place in the editor.
Won’t the objects created at runtime also appear within the 2D editor? I’m referring to the part I marked in the screenshot.
Otherwise, it will be difficult for me to develop the game. I need to track the behavior of the objects from the 2D editor.
Note: The current image is a runtime moment.
Ah, OK, I see what you’re asking.
No, the Godot editor (mostly) doesn’t mirror the running game. You can run in an embedded window, which might be kind of what you want?
Out of curiosity, why do you need to track behavior from the editor? There’s ways of tracking stuff from within the game if you’re just trying to debug.
I need to see where the object goes outside the scene. Because I have code like this:
public override void _Process(double delta)
{
fish.Position = fish.Position.MoveToward(finishLocation, 2f);
}
public void Init()
{
if (reverse)
{
fish.Position = new Vector2(x + 100, GD.RandRange(0, y));
finishLocation = new Vector2(-100, GD.RandRange(0, y));
fish.Scale = new Vector2(-1, 1);
reverse = false;
}
else
{
fish.Position = new Vector2(-100, GD.RandRange(0, y));
finishLocation = new Vector2(x + 100, GD.RandRange(0, y));
fish.Scale = new Vector2(1, 1);
reverse = true;
}
}
You can use a VisibleOnScreenNotifier2D node to get a signal when something enters or exits the screen. You can also get the screen size from the window viewport get_viewport().size
The code sample doesn’t help illuminate why you would need this information, it may help to explain what you are trying to do. Seems like we’ve gone through one XY problem and there may be another layer here.
If the object leaves the scene, I can’t see it. But I need to see it.
I don’t know what else I can explain.
Why do you need to see it? That’s the Y part of the problem, what X are you trying to solve by seeing the object?
Now, the Y part is important anyway; X could be any reason. Maybe I’ll send the objects back to the pool, or maybe I’ll do something else there.
Typically this is done by building debug scaffolding into the game itself, or sending information to the logger.
You can’t do this by looking at the editor, object management must be done at runtime, you’re not going to pick out every player’s fish by hand to re-allocate them are you? Using a VisibleOnScreenNotifier2D can however connect to a pooling/freeing function when something exits the screen.
When you export this project the editor won’t come along with it, you cannot do anything in the editor to a run-time object that would make sense outside of a purely researching-the-engine setting. If you only intend to play around with Godot then I’m sorry, it’s not built to show runtime objects in-editor, but you may be able to turn your code into a @tool script, though it could be much messier and cause editor crashes.
If you really just want to see farther you’ll have to add and manipulate a Camera2D node, add your own camera controls.
But in Unity3D, when I ran the game, everything was visible in the 2D editor. I’m not sure if I’m talking about something else, I didn’t really understand.
When I start the game, nothing appears in the 2D Editor; only the game scene and my objects are visible in a separate window, but the 2D editor itself is completely empty.
Unity embeds the game window, Godot has similar features, in this screenshot you can override the camera with the camera button by the mute and three dots,
As hexgrid said maybe you just want to embed the game window? Ensure your “Game” view has these two settings On and Off respectively, “Embed Game on Next Play” and “Make Game Workspace Floating on Next Play”
No but you can write tool scripts that run in the editor and do whatever you want to the editor scene tree from such scripts.