I just want to 1) instance a new Meshinstance3d, 2) make it a BoxMesh and then 3) apply a material to it (a material I've already made and saved as a resource). I want to do all of this IN SCRIPT not with the editor. I've been going around in circles between the API docs and a bunch of outdated tutorials but no matter what I try I can't make it work. The object never appears in the scene. This is the closest I've got... in my Main scene script
extends Node3D
var testMesh
var shinyOrangeMat = preload("res://shiny_orange_mat.tres")
func _ready():
testMesh = MeshInstance3D.new()
testMesh.mesh = BoxMesh.new()
testMesh.material_override = shinyOrangeMat
When I use "remote", Main has the instanced object, it has the correct mesh (the box mesh), the material override is apparently there, but the object does not appear (I'm assuming it should appear at 0,0,0 ?) I have a movable camera pointed at that spot and I've confirmed the obejct is flagged as "visible". Also there is a world environment and there are other hand-placed meshes in the scene, so I know the scene itself works.
I've probably missed something obvious. Any help would be appreciated. Thanks!