public static Transform NewTransform(string name, string undo, Transform p, Vector3? pos = null, Vector3? scl = null, Vector3? rot = null) { var t = new GameObject { name = name }.transform; Undo.RegisterCreatedObjectUndo(t.gameObject, undo); t.Reparent(undo, p); t.SetLocalTransform(undo, pos ?? Vector3.zero, scl ?? Vector3.one, rot ?? Vector3.zero); return t; }