# ObjectFactory

> Use the DefaultObject to create a new UnityEngine.Object in the editor.

## Definition

* **Type:** Class
* **Namespace:** [UnityEditor](/engine/6000.7/script-reference/unityeditor.md)
* **Assembly:** UnityEditor.CoreModule

```csharp
public static class ObjectFactory
```

## Remarks

The creation process handles Undo registration and applies default values from your project.

## Static Methods

| Method                                                                                            | Description                                                                                                                                                                                                                                         |
| ------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [AddComponent](/engine/6000.7/script-reference/unityeditor/objectfactory/addcomponent.md)         | Creates a new component and adds it to the specified GameObject.                                                                                                                                                                                    |
| [CreateGameObject](/engine/6000.7/script-reference/unityeditor/objectfactory/creategameobject.md) | Creates a new GameObject.                                                                                                                                                                                                                           |
| [CreateInstance](/engine/6000.7/script-reference/unityeditor/objectfactory/createinstance.md)     | Create a new instance of the given type.                                                                                                                                                                                                            |
| [CreatePrimitive](/engine/6000.7/script-reference/unityeditor/objectfactory/createprimitive.md)   | Creates a GameObject primitive with Undo support. The created primitive will have any existing Preset applied to it, see [Preset Manager](/engine/6000.7/manual/unity-editor/editor-settings-reference/comp-manager-group/class-preset-manager.md). |
| [PlaceGameObject](/engine/6000.7/script-reference/unityeditor/objectfactory/placegameobject.md)   | Place the given GameObject in the Scene View using the same preferences as built-in Unity GameObjects.                                                                                                                                              |

## Static Events

| Member                                                                                              | Description                                                                                                   |
| --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| [componentWasAdded](/engine/6000.7/script-reference/unityeditor/objectfactory/componentwasadded.md) | This is invoked every time a new Component or MonoBehaviour is added to a GameObject using the ObjectFactory. |
