- Home /
how can I load a mesh from a larger object in resources to put in a skinned mesh renderer at runtime?
I have already figured out how to get it correctly positioned and animated. In the editor I can go to assets, 'spread out' the fbx file, pull out the mesh I need and put it into the Mesh slot in a skinned mesh renderer. I need to know how to do that with script at runtime. I have seen many examples of people using mesh filter, but for some reason this gets an error how ever I try to do it so I think it might be obsolete or just people trying things that doesn't work. it either doesn't compile for me or I get an error at runtime saying that types can't be converted this way. I would prefer if I could to load the mesh directly. I have managed to load the whole fbx object, but I would prefer not to instantiate it at least.
I found a solution but I have to wait for the question to be approved before I can answer.
Answer by EvenArmless · Apr 23, 2015 at 09:04 PM
clothes = Resources.Load("Bigobject", typeof(GameObject)) as GameObject;
clothesMeshes = clothes.GetComponentsInChildren<SkinnedMeshRenderer>(true);
and then I can get clothesMeshes shared meshs, this works but I wish there was a better way.
true in getcomponents to get inactive objects
Your answer
