- Home /
Mesh wont render/ appears invisible
Hi there,
I'm trying to swap out the current torso mesh of my character with an armored mesh but things don't seem to be happening right. The current mesh just disappears and when I check the inspector on run the mesh and material are empty. Here's my code:
var oldmodel: GameObject = pc.myTransform.GetChild(1).gameObject;
var Swapper : SkinnedMeshRenderer = oldmodel.GetComponent(SkinnedMeshRenderer);
var SwapMesh: Mesh = Resources.Load("eq_chest_025", Mesh);
var SwapMet: Material = Resources.Load("dragonarmor", Material);
Swapper.sharedMesh = SwapMesh;
Any help would be appreciated. I also tried setting the shared material but no avail.
-Sohaib
Answer by Sohaib08 · Jul 25, 2012 at 05:16 PM
Well it seems like I'm getting closer to a solution. The meshes that work have uvs and skins and those that don't just have uvs. I get this error if I try to replace the mesh "Number of bind poses doesn't match number of bones in skinned mesh." Turns out that only models with armatures/bones are skinned so they can be replaced; Does that mean I have to import the whole armature aswell? I'll try and let you guys know...
Answer by DESTRUKTORR · Jul 25, 2012 at 04:13 PM
Chances are, it's not been properly scaled in the prefab for the mesh. Try checking it, and make sure it's not set to 0.01 (which, I believe, is default).
But here's something interesting some of the meshes have both uv and skin and those show up, where as some only have a uv and no skin and they don't. Can anyone explain?
Check that the applied material isn't set to "none." If there's no texture applied, none will show up.
Also make sure the normals are facing the right way.
Answer by Sohaib08 · Jul 26, 2012 at 01:35 PM
Yup, importing with armature works if you're using blender. I agree it's holding extraneous data that could increase each mesh up to about 200KB but that's my fix. There is a character Assets Bundle I could have looked into using bone transforms and whatever else like in the character customization demo, but I'm gonna stick with what's simple. Thanks!
Answer by scarletsnake · Dec 26, 2012 at 03:03 AM
Go into the model's specific mesh parts and assign them from your newly imported file. Under Skinned Mesh Renderer's Mesh tab it'll say Missing (Mesh). Click that and assign from there.
Your answer
Follow this Question
Related Questions
Mesh with copied material not showing in Game View and Forward Rendering Path 0 Answers
Textures not showing up 0 Answers
Create multiple meshs in one mesh 0 Answers
can't put texture materials on imported mesh. 1 Answer
Set an object to invisible? 2 Answers