Quantcast
Channel: Latest Questions by Benproductions1
Viewing all articles
Browse latest Browse all 28

AssetPostprocessor - Can't change Mesh Data

0
0
Hello again, For the past couple hours I've been trying to solve the old: "Blender Axis is different to Unity's" problem by writing an `AssetPostprocessor`. In the Unity Documentation for `AssetPostprocessor.OnPostprocessModel` it states: "This lets you modify the imported Game Object, Meshes, AnimationClips referenced by it", however after multiple attempts and a *ton* of google searches, I have not been able to change any mesh data and have it saved to disk: import System.IO; //Fix the ignorance of the standard Blender Importer!!! class BlenderAssetProcessor extends AssetPostprocessor { public function OnPostprocessModel(object:GameObject) { var importer : ModelImporter = assetImporter as ModelImporter; //Only rotate with blender files if (Path.GetExtension(importer.assetPath) == ".blend") { RotateObject(object); } } private function RotateObject(object:GameObject) { object.transform.rotation *= Quaternion.Euler(90, 0, 0); //This works and is saved var meshFilter:MeshFilter = object.GetComponent(MeshFilter); if (meshFilter) { //Use proven methods to manipulate the mesh data ChangeMesh(meshFilter.sharedMesh); //This changes the mesh, but nothing is saved??? } //--some code that calls this recursively for children I left out } } I get no errors and everything works absolutely fine, except for the fact that no mesh data is saved. Has anyone been able to achieve something similar? Is this even possible, because it definitely should be?!? Thanks for your help, Benproductions1

Viewing all articles
Browse latest Browse all 28

Latest Images

Trending Articles





Latest Images