# GetEnumerator()

> Retrieves an iterator for enumerating over the visible child properties of the current property. If the property is an array it will enumerate over the array elements.

## Definition

* **Type:** Method
* **Namespace:** [UnityEditor](/engine/6000.3/script-reference/unityeditor.md)
* **Assembly:** UnityEditor

```csharp
public IEnumerator GetEnumerator()
```

### Returns

| Type                                                                                 | Description |
| ------------------------------------------------------------------------------------ | ----------- |
| [IEnumerator](https://learn.microsoft.com/dotnet/api/system.collections.ienumerator) |             |

### Remarks

Additional Resources: [SerializedProperty.NextVisible](/engine/6000.3/script-reference/unityeditor/serializedproperty/nextvisible.md), [SerializedProperty.GetEndProperty](/engine/6000.3/script-reference/unityeditor/serializedproperty/getendproperty.md), [SerializedProperty.GetArrayElementAtIndex](/engine/6000.3/script-reference/unityeditor/serializedproperty/getarrayelementatindex.md)

### Examples

```csharp
using UnityEditor;
using UnityEngine;

public class EnumerateExample : ScriptableObject
{
    public Vector3 m_vector3 = new Vector3(1.0f, 2.0f, 3.0f);
    public int m_anotherField = 2;

    [MenuItem("Example/SerializedProperty GetEnumerator Example")]
    static void Example()
    {
        EnumerateExample obj = ScriptableObject.CreateInstance<EnumerateExample>();
        SerializedObject serializedObject = new SerializedObject(obj);
        SerializedProperty property = serializedObject.FindProperty("m_vector3");

        // Visit the x, y, z values of the vector, stopping once m_anotherField is reached
        var enumerator = property.GetEnumerator();
        while (enumerator.MoveNext())
        {
            property = enumerator.Current as SerializedProperty;
            Debug.Log(property.propertyPath + " : " + property.floatValue);
        }
    }
}
```
