Hey all–
I am trying to dynamically load meshes depending on how fast the game is running. I’m getting confused with getting the mesh out of the Hierarchy view–
Is there an easier way to getting the meshes from the resources? At the moment it seems something ugly like this:
if (runningSlow)
{
var myMeshFilter : MeshFilter = myMesh.GetComponent(MeshFilter);
//unity structures things in the hiearchy such that this would be a parent
var loadedGameObject : GameObject = Resources.Load(MyModel);
myMeshFilter.mesh = loadedGameObject.FindComponentInChildren(MeshFilter).mesh;
}
else
{
//similar to above but with different heirachy object
}
Does this sound about right? I’m trying out the above code right now…