Dynamically added MeshInstance3D is not visible

Godot Version

4.3

Question

I am trying to add this MeshInstance3D to my scene from a script:

Mesh PointMesh = ResourceLoader.Load<CylinderMesh>("res://Assets/MObjects/Point.res");

MeshInstance3D p = new MeshInstance3D()
{
				Mesh = new BoxMesh()
};
Scene3DRoot.AddChild(p);

The node shows up in the remote tab
image
But is nowhere to be found in-game

I have no idea what could be the problem. I appreciate any help, thanks

That screenshot is from the editor, not your runtime game. The editor viewport only shows things that are associated with the currently edited scene root, so you need to set the owner of newly tool script added nodes to the scene root. If you use different viewports you also need to make sure that they render to the same rendering scenario, if they use their own world they dont so it will not show.

I’m also seeing the same thing happen.

In my _Ready call, I’m trying to add new cubes to the scene (tried both CSGBox3D and MeshInstance3D with same results).

var box = new MeshInstance3D()
{
    Mesh = boxmesh,
    Transform = new()
    {
        Origin = new Vector3(x, y, z)
    },
    Visible = true
};

AddChild(box);

box.Owner = SceneRoot;

If I add an object to the same node in the editor with the same properties, I see it fine. I checked its owner and assign the same one here to the dynamic node, but I still don’t see them in the game window, even though I see them listed in the remote tab with all the same properties.

Apparently, Scale is Zero by default?

var box = new MeshInstance3D()
{
    Mesh = boxmesh,
    Transform = new()
    {
        Origin = new Vector3(x, y, z),
    },
    Scale = Vector3.One, // Zero by default?
    Visible = true,
};

As soon as I added that, it worked for me.