How to change mesh of "MeshInstance" in "FileDialog".

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Gangster53 YT

How to change mesh of “MeshInstance” in “FileDialog”

How can I transfer the 3D model selected by the user over “FileDialog” to my game? So how do I pass that selected model to the “MeshInstance” node?

:bust_in_silhouette: Reply From: Wakatta

Connect the file_selected signal of the FileDialog to the MeshInstance

#MeshInstance.gd

func _on_file_selected(path):
    var res = load(path)
    if res is Mesh:
        set_mesh(res)

I tried what you said but it doesn’t work. I want to open an obj file. So replace the “mesh” with the selected “obj” file. When I do as you said, it does not give an error, but “obj” does not open.

Gangster53 YT | 2022-10-28 11:25