# stringValue

> Value of a string property.

## Definition

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

```csharp
public string stringValue { get; set; }
```

### Remarks

Contains a valid value only if [SerializedProperty.propertyType](/engine/6000.5/script-reference/unityeditor/serializedproperty/propertytype.md) is [SerializedPropertyType.String](/engine/6000.5/script-reference/unityeditor/serializedpropertytype/string.md), otherwise accessing it results in an error logged.

Additional Resources: [SerializedProperty.propertyType](/engine/6000.5/script-reference/unityeditor/serializedproperty/propertytype.md), [SerializedPropertyType.String](/engine/6000.5/script-reference/unityeditor/serializedpropertytype/string.md).

### Examples

```csharp
using UnityEngine;
using UnityEditor;

public class SerializedPropertyStringExample : ScriptableObject
{
    public string m_string;

    [MenuItem("Example/SerializedProperty stringValue Set Example")]
    static void StringValueExample()
    {
        var scriptableObject = ScriptableObject.CreateInstance<SerializedPropertyStringExample>();
        using (var serializedObject = new SerializedObject(scriptableObject))
        {
            SerializedProperty stringField = serializedObject.FindProperty("m_string");
            stringField.stringValue = "Hello World";
            serializedObject.ApplyModifiedProperties();
        }

        // Save the ScriptableObject into the Project.
        // Viewing this Asset in the inspector will show the value of m_string as "Hello World"
        AssetDatabase.CreateAsset(scriptableObject, "Assets/Editor/SerializedPropertyStringExample.asset");
    }
}
```

```csharp
using UnityEditor;
using UnityEngine;

public class SerializedPropertyStringExample2
{
    [MenuItem("Example/SerializedProperty stringValue Get Example")]
    public static void PrintStringProperties()
    {
        // Retrieve the currently selected Scene object in the Hierarchy Window,
        // or Asset selected in the project view
        var selectedObject = Selection.activeObject;
        if (selectedObject == null)
        {
            Debug.Log("No object selected.");
            return;
        }

        SerializedObject serializedObject = new SerializedObject(selectedObject);

        // Get the base property
        SerializedProperty property = serializedObject.GetIterator();

        // Move to the first property
        bool visitChildren = true;
        property.NextVisible(visitChildren);

        visitChildren = false;

        // Iterate through all the top level properties (not recursive)
        do
        {
            if (property.propertyType == SerializedPropertyType.String)
            {
                Debug.Log($"Property: {property.name}, Value: {property.stringValue}");
            }
        }
        while (property.NextVisible(false));
    }
}
```
