I’m trying to create a new gameobject at runtime and assign it a mesh.
In my subfolder Assets/toto there is a 3ds file named mymesh.3DS including a mesh named struct (I can chek the mesh named struct in the Mesh selection Editor of Unity).
My instructions are :
Mesh TMesh = (Mesh)Resources.Load("Assets/toto/mymesh.3DS", typeof(Mesh));
var Objet = new GameObject();
Objet .AddComponent<MeshFilter>();
Objet .AddComponent<MeshRenderer>();
Objet .GetComponent<MeshFilter>().mesh = TMesh;
But the mesh does’nt load when I run the script. I can check it in the EditBox of the mesh Filter editor indicating None (Mesh)
“All assets that are in a folder named “Resources” anywhere in the Assets folder can be accessed via the Resources.Load functions. Multiple “Resources” folders may exist and when loading objects each will be examined.”
“The path is relative to any Resources folder inside the Assets folder of your project”
(Resources.Load need a Resource folder to be able to Load a file)