resources.load a fbx format

I want to resources.load a fbx format file,and get one mesh in the fbx, how can i do?

1 Like

Make the FBX object a prefab. It will then have a GameObject that you can use to access the mesh, etc.

when i get a GameObject ,plese print the code about how i get the mesh?

if i use GameObject.Find the mesh name,error message is static member"…"cannot be accessed with an instance refernce,qualify it with a type name instead!

another question:Example the mesh name is abc,i use function GetComponentsInChildren ,but i can get two abc mesh,why?

The manual page for the Mesh class has some code to show how to access the mesh from a GameObject. You probably need to use GetComponent rather than GetComponents in children - the example shows you how.

Hi,

I have a .fbx file with multiple meshes inside and if I use Resources.Load I only get the first mesh in the .fbx:
Mesh theNewMesh = ( Mesh )Resources.Load((“FbxName”), typeof( Mesh ));

How I get all meshes in the .fbx into Unity ?

Best
Greetings
Timo

1 Like

Necroposting, but…

Mesh[ ] meshes = Resources.LoadAll(“path/to/fbx”);

foreach (Mesh m in meshes)
{
Debug.Log("meshname: " + m.name);
}

1 Like