Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | scolllly93 |
Hey, guys. I’m trying to use a scene as a mesh from code for the Meshintance of a KB when running the game but nothing appears.
The funny part is when using CubeMesh the Cube appears on the screen.
Any ideas?
func _ready():
sprite = MeshInstance.new()
var mesh = load("res://assets/asset_test.tscn").instance()
# var mesh = CubeMesh.new() THIS WORKS
sprite.set_mesh(mesh)
var material = SpatialMaterial.new();
material.albedo_color = Color.red
sprite.set_surface_material(0,material)
sprite.name = "Sprite"
add_child(sprite)