Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Advanced MER tools/AutoScaler.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif

public class AutoScaler : MonoBehaviour
{
Expand All @@ -16,11 +19,16 @@ private void OnDrawGizmos()
Vector3 v2 = game.eulerAngles;
Vector3 v3 = game.lossyScale;
pairs.Add(game, new Values(IsEmpty(game.gameObject) && ResetPos ? Vector3.zero : new Vector3(v1.x, v1.y, v1.z),
IsEmpty(game.gameObject) && ResetRot ? Vector3.zero : new Vector3(v2.x, v2.y, v2.z),
IsEmpty(game.gameObject) && ResetRot ? Vector3.zero : new Vector3(v2.x, v2.y, v2.z),
IsEmpty(game.gameObject) && ResetScl ? Vector3.one : new Vector3(v3.x, v3.y, v3.z)));
}
List<Transform> list = new List<Transform> { };
list.AddRange(this.transform.GetComponentsInChildren<Transform>());

#if UNITY_EDITOR
Undo.RecordObjects(list.ConvertAll(t => (Object)t).ToArray(), "Auto Scale Adjustments");
#endif

list.ForEach(x =>
{
Values values = pairs[x];
Expand Down