Skip to content
Snippets Groups Projects
Commit 038bd835 authored by mhby1g21's avatar mhby1g21
Browse files

excluded meshdimensioncalculator logic functions from #if UNITY_EDITOR and...

excluded meshdimensioncalculator logic functions from #if UNITY_EDITOR and removed unity editor undo functions
parent 27bb88f7
No related branches found
No related tags found
3 merge requests!9working premade rooms ui, also exportable as .exe (works),!8added #if UNITY_EDITOR #endif directives to all editor related scripts to...,!7added #if UNITY_EDITOR #endif directives to all editor related scripts
#if UNITY_EDITOR
using UnityEngine; using UnityEngine;
using UnityEditor; using UnityEditor;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -80,7 +79,6 @@ public static class MeshDimensionCalculatorLogic ...@@ -80,7 +79,6 @@ public static class MeshDimensionCalculatorLogic
return; return;
} }
Undo.RecordObject(targetObject.transform, "Reset To Origin");
targetObject.transform.position = Vector3.zero; targetObject.transform.position = Vector3.zero;
Debug.Log("Target object has been reset to (0,0,0)."); Debug.Log("Target object has been reset to (0,0,0).");
} }
...@@ -93,7 +91,6 @@ public static class MeshDimensionCalculatorLogic ...@@ -93,7 +91,6 @@ public static class MeshDimensionCalculatorLogic
return; return;
} }
Undo.RecordObject(targetObject.transform, "Reset Floor To Zero");
Vector3 currentPosition = targetObject.transform.position; Vector3 currentPosition = targetObject.transform.position;
Vector3 newPosition = new Vector3(currentPosition.x, -floorY, currentPosition.z); Vector3 newPosition = new Vector3(currentPosition.x, -floorY, currentPosition.z);
targetObject.transform.position = newPosition; targetObject.transform.position = newPosition;
...@@ -108,7 +105,6 @@ public static class MeshDimensionCalculatorLogic ...@@ -108,7 +105,6 @@ public static class MeshDimensionCalculatorLogic
return; return;
} }
Undo.RecordObject(targetObject.transform, "Scale Object");
Vector3 currentScale = targetObject.transform.localScale; Vector3 currentScale = targetObject.transform.localScale;
Vector3 newScale = Vector3.Scale(currentScale, scaleFactors); Vector3 newScale = Vector3.Scale(currentScale, scaleFactors);
targetObject.transform.localScale = newScale; targetObject.transform.localScale = newScale;
...@@ -123,7 +119,6 @@ public static class MeshDimensionCalculatorLogic ...@@ -123,7 +119,6 @@ public static class MeshDimensionCalculatorLogic
return; return;
} }
Undo.RecordObject(targetObject.transform, "Scale Object Uniform");
Vector3 currentScale = targetObject.transform.localScale; Vector3 currentScale = targetObject.transform.localScale;
Vector3 newScale = currentScale * uniformScaleFactor; Vector3 newScale = currentScale * uniformScaleFactor;
targetObject.transform.localScale = newScale; targetObject.transform.localScale = newScale;
...@@ -138,7 +133,6 @@ public static class MeshDimensionCalculatorLogic ...@@ -138,7 +133,6 @@ public static class MeshDimensionCalculatorLogic
return; return;
} }
Undo.RecordObject(targetObject.transform, "Reset Scale");
targetObject.transform.localScale = Vector3.one; targetObject.transform.localScale = Vector3.one;
Debug.Log("Target object scale has been reset to (1, 1, 1)."); Debug.Log("Target object scale has been reset to (1, 1, 1).");
} }
...@@ -167,7 +161,6 @@ public static class MeshDimensionCalculatorLogic ...@@ -167,7 +161,6 @@ public static class MeshDimensionCalculatorLogic
} }
Vector3 scaleFactors = CalculateScaleFactorsForTargetDimensions(currentDimensions, targetDimensions); Vector3 scaleFactors = CalculateScaleFactorsForTargetDimensions(currentDimensions, targetDimensions);
Undo.RecordObject(targetObject.transform, "Scale To Target Dimensions");
Vector3 currentScale = targetObject.transform.localScale; Vector3 currentScale = targetObject.transform.localScale;
Vector3 newScale = Vector3.Scale(currentScale, scaleFactors); Vector3 newScale = Vector3.Scale(currentScale, scaleFactors);
targetObject.transform.localScale = newScale; targetObject.transform.localScale = newScale;
...@@ -175,6 +168,7 @@ public static class MeshDimensionCalculatorLogic ...@@ -175,6 +168,7 @@ public static class MeshDimensionCalculatorLogic
} }
} }
#if UNITY_EDITOR
// MonoBehaviour Component // MonoBehaviour Component
public class MeshDimensionCalculator : MonoBehaviour public class MeshDimensionCalculator : MonoBehaviour
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment