# AddStringEntry(string, string, bool?)

> Adds or updates a plain string entry for a key.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Localization](/engine/6000.7/script-reference/unity/localization.md)
* **Assembly:** UnityEngine.LocalizationRuntimeModule

```csharp
public StringEntry AddStringEntry(string key, string value, bool? isSmart = null)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The key text; added to the shared data when new.**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The localized value to store for this locale.**** (\[bool?]\(https\://learn.microsoft.com/dotnet/api/system.nullable)): Whether the value is a Smart String, formatted at resolve time; omit it to leave the key's flag unchanged.

### Returns

| Type                                                                             | Description                                                    |
| -------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| [StringEntry](/engine/6000.7/script-reference/unity/localization/stringentry.md) | The added or updated entry, or `null` when it cannot be added. |

### Remarks

Adds the key to [ResourceTable.SharedData](/engine/6000.7/script-reference/unity/localization/resourcetable/shareddata.md) when it is new, then stores the value for this locale. When an entry already exists for the key, its value is overwritten. When `isSmart` is supplied it is stored on the shared key, so it applies to every locale and can turn an existing key back into a plain string; when it is omitted the key's existing flag is left unchanged. Returns `null` when no shared data is assigned or the key is empty.

Additional Resources: [ResourceTable.AddEntry](/engine/6000.7/script-reference/unity/localization/resourcetable/addentry.md), [ResourceTable.GetEntry](/engine/6000.7/script-reference/unity/localization/resourcetable/getentry.md), [IStringEntry](/engine/6000.7/script-reference/unity/localization/istringentry.md)

Add plain and Smart String entries to a table.

### Examples

```csharp
using Unity.Localization;
using UnityEngine;

namespace Unity.Localization.Samples
{
    public class ResourceTableAddStringEntryExample
    {
        public void Run()
        {
            var shared = ScriptableObject.CreateInstance<SharedTableData>();
            var table = ScriptableObject.CreateInstance<ResourceTable>();
            table.SharedData = shared;
            table.LocaleIdentifier = "en";

            StringEntry greeting = table.AddStringEntry("Greeting", "Hello");
            Debug.Log(greeting.Value); // Hello

            table.AddStringEntry("Score", "You scored {0}", isSmart: true);
        }
    }
}
```
