I have the following collection in C# which is sent to Google servers (Firebase Remote Config).
I want to add values in the Unity inspector itself and not in code. As you can see, the values can be any type (bool, string, int, etc).
System.Collections.Generic.Dictionary<string, object> defaults =
new System.Collections.Generic.Dictionary<string, object>();
defaults.Add("config_test_string", "default local string");
defaults.Add("config_test_int", 1);
defaults.Add("config_test_float", 1.0);
defaults.Add("config_test_bool", false);
Basically I've done this:
[Serializable]
public struct RemoteValueConfig {
public string key;
public object defaultValue;
}
public RemoteValueConfig[] valuesToFetch;
But it doesn't work, since the "object" type won't show up in the Unity inspector. If I only needed string objects, I would simply replace defaultValue
which is of type object, with a string type and this would solve my problem. But I can have int's, float's, strings, bool, etc.
How can I populate values in this scenario (and what to use), to work with Unity inspector?