private static bool RedoProbuilderize(Record record) { ProBuilderizer proBuilderizer = (ProBuilderizer)record.Target; proBuilderizer.Redo(); return(true); }
private object OnProBuilderize(object arg) { GameObject[] gameObjects = Editor.Selection.gameObjects; if (gameObjects == null) { return(null); } Transform[] transforms = gameObjects.Select(g => g.transform).ToArray(); gameObjects = gameObjects.Where(g => !transforms.Any(t => IsDescendant(t, g.transform))).ToArray(); ProBuilderizer proBuilderizer = new ProBuilderizer(gameObjects); Editor.Undo.CreateRecord(proBuilderizer, null, null, RedoProbuilderize, UndoProbuilderize); proBuilderizer.Redo(); return(null); }