File size: 1,085 Bytes
f898c07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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();
            }
        }
    }
}