Пример #1
0
        private static bool UndoProbuilderize(Record record)
        {
            ProBuilderizer proBuilderizer = (ProBuilderizer)record.Target;

            proBuilderizer.Undo();
            return(true);
        }
Пример #2
0
        private object OnUnproBuilderize(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, UndoProbuilderize, RedoProbuilderize);
            proBuilderizer.Undo();
            return(null);
        }