| using UnityEditor; | |
| using UnityEngine; | |
| using System.Collections.Generic; | |
| public class RotationFix | |
| { | |
| [MenuItem("Tools/Update Rotation")] | |
| static void UpdateRotation() | |
| { | |
| GameObject[] allGameObjects = Resources.FindObjectsOfTypeAll<GameObject>(); | |
| Transform transform; | |
| SerializedObject serializedTransform; | |
| SerializedProperty m_LocalEulerAnglesHint; | |
| foreach (GameObject go in allGameObjects) | |
| { | |
| transform = go.GetComponent<Transform>(); | |
| serializedTransform = new SerializedObject(transform); | |
| m_LocalEulerAnglesHint = serializedTransform.FindProperty("m_LocalEulerAnglesHint"); | |
| if (m_LocalEulerAnglesHint.vector3Value[0] == 179.999f && | |
| m_LocalEulerAnglesHint.vector3Value[1] == 179.999f && | |
| m_LocalEulerAnglesHint.vector3Value[2] == 179.999f) | |
| { | |
| m_LocalEulerAnglesHint.vector3Value = Vector3.zero; | |
| serializedTransform.ApplyModifiedProperties(); | |
| } | |
| } | |
| } | |
| } |