Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [MenuItem("CONTEXT/Transform/Posisition Insted Selected", false, 151)]
- public static void PosisitionInstedSelected()
- {
- Selection.gameObjects.Log();
- var target = Selection.gameObjects.First().transform;
- Undo.RecordObject(target, "target");
- Undo.FlushUndoRecordObjects();
- var transform = Selection.gameObjects[1].transform;
- Undo.RecordObject(transform, "transform");
- Undo.FlushUndoRecordObjects();
- var childs = target.GetChilds();
- target.DetachChildren();
- Debug.Log($"target : {target} : {target.position}", target);
- Debug.Log($"transform : {transform} : {transform.position}", transform);
- target.position = transform.position;
- Debug.Log($"target : {target} : {target.position}", target);
- Debug.Log($"transform : {transform} : {transform.position}", transform);
- childs.ForEach(t => t.SetParent(target));
- }
- [MenuItem("CONTEXT/Transform/Posisition Insted Selected", true, 151)]
- public static bool CheckFromInsted()
- {
- return Selection.gameObjects != null && Selection.gameObjects.Length == 2;
- }
Add Comment
Please, Sign In to add comment