static void CreateCompoundBrush(object compoundBrushType) { // Make sure we're actually being asked to create a compound brush if (compoundBrushType != null && compoundBrushType == typeof(Type) && !typeof(CompoundBrush).IsAssignableFrom((Type)compoundBrushType)) { throw new ArgumentException("Specified type must be derived from CompoundBrush"); } Vector3 position = GetPositionForNewBrush(); GameObject newBrushObject = csgModel.CreateCompoundBrush((Type)compoundBrushType, position); // Set the selection to the new object Selection.activeGameObject = newBrushObject; Undo.RegisterCreatedObjectUndo(newBrushObject, "Create Brush"); }