Setting Attribute value in inspector.

Is there a way to set the value of an Attribute in the inspector?

The attribute I’m trying to set is the DynamoDBTable from the AWSSDK.
I’ve got this now, but constant variables can’t be exposed to the inspector AFAIK.

public const string tableName="tableName";

[DynamoDBTable(tableName)]
public class DynamoTable
{
....

And a normal variable won’t work because the attribute needs a constant value.

Is there anyway to expose the constant variable in the inspector, like only while !EditorApplication.isPlaying.

I’m trying to make it possible to for anyone to adjust the tableName from the inspector so the script won’t have to be edited by a programmer for each change.

Update*

I found a way to do it from the editor but its kinda hacky, all the database table classes are in the folder located at path. I load the text of these classes and extract the table name from the DynamoDBTable attribute, which I can then change with String.Replace, save over the old .cs file and finally force a recompile with AssetDatabase.ImportAsset.

This kinda works but sometimes has some issues where it renames mutiple files somehow.

 void OnGUI()
    {
        if (GUILayout.Button("GetTables"))
        {
            GetTableClasses();
        }
        if (files == null)
            return;

        EditorGUILayout.LabelField("DynamoDB tables", EditorStyles.boldLabel);
        string[] currentNames = new string[files.Keys.Count];
        files.Keys.CopyTo(currentNames, 0);

        foreach (string tableName in currentNames)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(files[tableName].Name);
            string newName = EditorGUILayout.DelayedTextField(tableName);
            EditorGUILayout.EndHorizontal();

            if (newName != tableName)
                ChangeTableName(tableName, newName);
        }
    }

   void GetTableClasses()
        {
            files = new Dictionary<string, FileInfo>();
            var info = new DirectoryInfo(path);
            var fileInfo = info.GetFiles("*.cs");
            foreach (FileInfo fileI in fileInfo)
            {
                StreamReader reader = fileI.OpenText();
                string file = reader.ReadToEnd();
                reader.Close();
                files.Add(IsolateTableName(file), fileI);
            }
        }
        string IsolateTableName(string file)
        {
            string[] strings = file.Split(new string[] { "DynamoDBTable(\"" }, StringSplitOptions.None);
            return strings[1].Substring(0, strings[1].IndexOf("\")]"));
        }

    void ChangeTableName(string oldName, string newName)
    {
        StreamReader reader = files[oldName].OpenText();
        string file = reader.ReadToEnd();
        reader.Close();
        file = file.Replace("(\"" + oldName + "\")]", "(\"" + newName + "\")]");
        File.WriteAllText(files[oldName].FullName, file);
        FileInfo fi = files[oldName];
        files.Remove(oldName);
        files.Add(newName, fi);

        AssetDatabase.ImportAsset(path+@"\"+files[newName].Name);
    }

Static, const, and readonly fields can’t be set in the inspector. Static fields don’t work because they belong to the class itself rather than individual components, readonly fields don’t work because they can’t be changed after being initialized, and constant fields don’t work because they have both of these problems. If you want the field to be set in the inspector, it can’t be a constant.