using System; using UnityEngine; using System.Collections; using System.Collections.Generic; using SimpleJSON; namespace VamWizard { public class FlipNormals : MVRScript { public override void Init() { try { FlipNormals_(); } catch (Exception e) { SuperController.LogError("Exception caught: " + e); } } void OnDestroy() { FlipNormals_(); } void FlipNormals_() { var parentTransforms = this.GetComponentsInParent(); Transform root = null; foreach (var item in parentTransforms) { if (item.name == "reParentObject") { root = item; break; } } Mesh mesh = root.GetComponentInChildren().mesh; var normals = mesh.normals; for (int i = 0; i < normals.Length; i++) { normals[i] = normals[i] * -1; } mesh.normals = normals; root.GetComponentInChildren().mesh = mesh; } } }