public void OnEnable() { grid = target as GhostGrid; children = grid.GetComponentsInChildren<Transform>(); message = ""; DirectoryInfo dir = new DirectoryInfo("Assets/Resources"); prefabsFileInfo = dir.GetFiles("*.prefab"); }
private static void SnapSelectedGrid() { GhostGrid grid = Selection.activeTransform.GetComponentInParent <GhostGrid>(); if (grid != null) { grid.doAutoSnap = false; grid.SnapAll(); Debug.Log("GhostGrid :: Grid snapped!"); } else { Debug.Log(NOT_FOUND); } }
private static void EnableGridAutoSnap() { GhostGrid grid = Selection.activeTransform.GetComponentInParent <GhostGrid>(); if (grid != null) { grid.SnapAll(); grid.doAutoSnap = true; Debug.Log("GhostGrid :: Auto Snap enabled on selected grid!"); } else { Debug.Log(NOT_FOUND); } }
private static void EnableGridAutoSnap() { GhostGrid grid = Selection.activeTransform.GetComponentInParent <GhostGrid>(); if (grid != null) { grid.SnapAll(); grid.autoSnapEnabled = true; Debug.Log("GhostGrid :: Grid auto snap enabled!"); } else { Debug.Log("GhostGrid :: GhostGrid not found on selected transform (or parents)."); } }
private static void SnapSelectedGrid() { GhostGrid grid = Selection.activeTransform.GetComponentInParent <GhostGrid>(); if (grid != null) { grid.autoSnapEnabled = false; grid.SnapAll(); Debug.Log("GhostGrid :: " + grid.quantity + " elements snapped! Grid auto snap disabled."); } else { Debug.Log("GhostGrid :: GhostGrid not found on selected transform (or parents)."); } }
private static void MenuApplyCurrentOptimizations() { GhostGrid grid = Selection.activeTransform.GetComponentInParent <GhostGrid>(); if (grid != null) { int howMany = 0; List <string> messages = new List <string>(); if (grid.doCleanOverlappedChildren) { howMany = grid.ExcludeOverlappedChildren(true); messages.Add(howMany + " overlapped deleted"); } if (grid.doTurnOffUnneededColliders2D) { howMany = grid.TurnOffUnneededColliders2D(); messages.Add(howMany + " unneeded 2D colliders were turned off"); } if (grid.doRename) { howMany = grid.RenameChildren(); messages.Add(howMany + " renamed"); } // Messages string message = ""; for (int i = 0; i < messages.Count; i++) { message += messages[i] + (i + 1 < messages.Count ? ", " : "."); } message = message.Length > 1 ? message : "Nothing to do. Check the current options on the selected GhostGrid."; Debug.Log("GhostGrid :: " + message); } else { Debug.Log(NOT_FOUND); } }
private static void MenuEnterExtrusionMode() { GhostGrid grid = Selection.activeTransform.GetComponentInParent <GhostGrid>(); if (grid != null) { grid.doExtrusionMode = !grid.doExtrusionMode; if (grid.doExtrusionMode) { Selection.activeGameObject = grid.gameObject; } Debug.Log("GhostGrid :: Extrusion mode " + (grid.doExtrusionMode ? "enabled!" : "disabled.")); } else { Debug.Log(NOT_FOUND); } }
private static void PurgeAll() { GhostGrid grid = Selection.activeTransform.GetComponentInParent <GhostGrid>(); if (grid != null) { int howMany = grid.ExcludeOverlappedChildren(); if (howMany > 0) { Debug.Log("GhostGrid :: " + howMany + " overlapped children moved to [GhostGrid:Overlapped] GameObject."); } else { Debug.Log("GhostGrid :: The grid is clean! Nothing overlapped."); } } else { Debug.Log("GhostGrid :: GhostGrid not found on selected transform (or parents)."); } }
public void OnEnable() { grid = target as GhostGrid; }
public void OnEnable() { grid = target as GhostGrid; message = ""; }