# Variables / Fields Not Appearing in Inspector?

### Adding New Fields to the Custom Inspector

{% hint style="warning" %}
The video below will explain how to add fields or variables to the DoorInteractable script as it uses a custom inspector
{% endhint %}

{% embed url="<https://drive.google.com/file/d/18uY9fKvp95RKpm7bbVBXQGCs415wP6WO/view?usp=sharing>" %}

### Code Examples:&#x20;

1. Add a field as below into the **DoorInteractable** script

```csharp
[SerializeField] private GameObject exampleField = null;
```

2. Open the **DoorInteractableEditor** script - At the top of the script created a new property with the same name like:&#x20;

```csharp
SerializedProperty exampleField;
```

3. Find the **OnEnable()** method and add a new find property reference as below:&#x20;

```csharp
exampleField = serializedObject.FindProperty(nameof(exampleField));
```

4. In the methods below that, find a place for your new field. I've grouped them together to make it more readable. Add a property GUI field:&#x20;

```csharp
EditorGUILayout.PropertyField(exampleField);
```

### Understanding Custom Editors:

{% hint style="info" %}
Below is a ttuorial I made to highlight the usage and examples of custom inspectors / editors&#x20;
{% endhint %}

{% embed url="<https://youtu.be/xFtFWmiW7IE>" %}
