- Home /
How would I display a submesh from a prefab with animations?
Hello, I am having trouble displaying and hiding specific sub-meshes of a prefab. I am making a character customization screen with c#. As of right now I have the ui laid out and I can load in specific prefabs for the characters. I basically want to know how I would hide certain sub-meshes on the model when loaded, and cycle between other sub-meshes such as hair styles.
as of right now I have a button setup to cycle between prefabs based by number. but I need to know how to hide objects on loading the prefab. and how to display others when pressing a this button. private int Model = 0; private GameObject currentModel;
if (GUILayout.Button ("<")) {
if (player.Race == Race.Human && player.Class == Class.Warrior && player.Gender == Gender.Male) { Destroy(currentModel); Model +=0; currentModel = Instantiate (humanMaleWarrior[Model]) as GameObject; if (Model >10) { Model = 0; }
}
In this button I am able to grab a model and cycle between 11 different prefabs. my problem is I can't put a submesh to a prefab in because it won't be animated. how can I make it so this button will grab sub-meshes from the specified prefab, and then add or remove it from the stage?