Hey,
is there a list of platforms that remote config supports somewhere? can’t find anything
Hey,
is there a list of platforms that remote config supports somewhere? can’t find anything
The supported platform would include iOS, Android, Windows, Mac and WebGL
Hi. It seems that unity.platform==‘iOS’ and unity.platform==‘Android’ do not work. When I use them as a condition in a Rule of remote config, I always get the default value, not a specified value (which might override the default value). However, when I set, for example, unity.country=‘US’ everything works fine. I use Remote Config 1.2.2 and Unity 2019.3.10f1, Development Environment. Is it a bug?
What devices are you testing on?
iPhone 6s, Nexus 5, Nexus 9, Galaxy S4
Got it, just wanted to make sure you weren’t using an emulator. Can you share a screenshot of your rule settings, and your code?
Here it is
using Unity.RemoteConfig;
using UnityEngine;
using Utils;
namespace RemoteConfigs
{
public class RemoteConfigsManager : Singleton<RemoteConfigsManager>
{
private struct userAttributes
{
}
private struct appAttributes
{
}
protected override void Awake()
{
base.Awake();
FetchRemoteConfiguration();
}
private void FetchRemoteConfiguration()
{
if (gameObject.activeSelf)
{
ConfigManager.FetchCompleted += ApplyRemoteSettings;
ConfigManager.FetchConfigs(new userAttributes(), new appAttributes());
Debug.Log("Fetched remote configs");
}
}
private void ApplyRemoteSettings(ConfigResponse configResponse)
{
switch (configResponse.requestOrigin)
{
case ConfigOrigin.Default:
Debug.Log("No Settings this session; using default values");
break;
case ConfigOrigin.Cached:
Debug.Log("No setting loaded this session; using cached values from a previous session.");
break;
case ConfigOrigin.Remote:
Debug.Log("New Settings loaded this session; update values accordingly");
GetSetting();
break;
}
}
private void GetSetting()
{
var setting1 = ConfigManager.appConfig.GetString("Setting1");
Debug.Log($"We fetched Setting1: {setting1}");
}
protected override void OnDestroy()
{
base.OnDestroy();
ConfigManager.FetchCompleted -= ApplyRemoteSettings;
}
}
}
@Ievgen0101 Are you certain your devices aren’t retrieving from the Release environment? Remote Config sends settings from the Release environment to any non-development builds.
The thing is my release environment is empty. It doesn’t have any config or rule. Moreover, when I build I select a development build option.
@Ievgen0101 Got it, I am checking.
@Ievgen0101 I am seeing the same behavior, we are looking into it now.
@JeffDUnity3D Great! Thank you for studying this case.
Hi @Ievgen0101 , thanks for pointing this out.
We just released new package version with a fix for platform segmentation:
1.3.2-preview.2 or 1.2.3-preview.1 if you were on 1.2.x version.
Please let us know if platform segmentation works if you update the package.
Thanks,
Vlatko
@vd_unity Hi Vlatko. I updated remote config to “1.2.3”. What I see now is unity.platform==‘iOS’ and unity.platform==‘macOS’ work now. However unity.platform==‘Android’ - doesn’t work, at least on my side (tested on several devices which I mentioned earlier in this thread). On Android I always get the default value and never the specified value.
I’ve tried it on 1.2.x—1.4.1 and can confirm that unity.platform == “Android” rule doesn’t work.
Specifying Windows works, default config fetching works. But Android rule doesn’t work at all.
(No emulator, build only, on Xiaomi Redmi Note 8)
Temporary workaround for me that works was to add “platform” field to the “appAttributes” struct:
public struct appAttributes {
public string platform;
}
Then assign “platform” via define (this also removes the need to add || for the rule to work with editor) for the appAttributes struct that is passed to FetchConfig method.
#if UNITY_IOS
string platform = "iOS";
#else
string platform = "Android";
#endif
appAttributes appAttributes = new appAttributes {platform = platform};
After that - redefine rule as:
app.platform == "*your_platform*"
Hi! What about Linux? Is it supported there? Thanks!
Please see this previous post here https://discussions.unity.com/t/772325/2
the problem still exists from the mentioned versions up to version 2.0.0. I successfully can retrieve the remote settings when running in the editor or standalone build, but running on android, the retrieved remote config is empty.
Here is my code:
internal static void SelectTestGroup(int option)
{
ConfigManager.FetchCompleted += (config) =>
{
string ip;
switch (config.requestOrigin)
{
case ConfigOrigin.Default:
case ConfigOrigin.Cached:
case ConfigOrigin.Remote:
Debug.Log($"settings loaded via {config.requestOrigin} mode; update values accordingly.");
ip = ConfigManager.appConfig.GetString("backend_ip");
Debug.Log($"backend IP: {ip}");
NakamaConnector.Instance.Initialize(ip);
UnityEngine.SceneManagement.SceneManager.LoadScene(1);
break;
}
};
string userCustomId;
// Set the user’s unique ID:
switch (option)
{
case 1:
userCustomId = "test-group-a";
break;
case 2:
userCustomId = "test-group-b";
break;
default:
userCustomId = "";
break;
}
ConfigManager.SetCustomUserID(userCustomId);
string platform = "Android";
// Fetch configuration setting from the remote service:
ConfigManager.FetchConfigs(new UserAttributes(), new AppAttributes() { platform = platform });
}
}
here is the result I get using logcat :
I/Unity ( 7043): settings loaded via Remote mode; update values accordingly.
I/Unity ( 7043): UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
I/Unity ( 7043): UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
I/Unity ( 7043): UnityEngine.Logger:Log(LogType, Object)
I/Unity ( 7043): UnityEngine.Debug:Log(Object)
I/Unity ( 7043): Davaa.Providers.<>c:<SelectTestGroup>b__0_0(ConfigResponse) (at C:\gamedev\davaa\Davaa\Assets\Scripts\Providers\RemoteConfigProvider.cs:18)
I/Unity ( 7043): Unity.RemoteConfig.<>c__DisplayClass34_0:<PostConfig>b__0(AsyncOperation) (at C:\gamedev\davaa\Davaa\Library\PackageCache\com.unity.remote-config@1.3.2-preview.2\Runtime\ConfigManager.cs:252)
I/Unity ( 7043): UnityEngine.AsyncOperation:InvokeCompletionEvent() (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/AsyncOperation.cs:21)
I/Unity ( 7043):
I/Unity ( 7043): (Filename: C Line: 0)
I/Unity ( 7043):
I/Unity ( 7043): backend IP:
I/Unity ( 7043): UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
I/Unity ( 7043): UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
I/Unity ( 7043): UnityEngine.Logger:Log(LogType, Object)
I/Unity ( 7043): UnityEngine.Debug:Log(Object)
I/Unity ( 7043): Davaa.Providers.<>c:<SelectTestGroup>b__0_0(ConfigResponse) (at C:\gamedev\davaa\Davaa\Assets\Scripts\Providers\RemoteConfigProvider.cs:21)
I/Unity ( 7043): Unity.RemoteConfig.<>c__DisplayClass34_0:<PostConfig>b__0(AsyncOperation) (at C:\gamedev\davaa\Davaa\Library\PackageCache\com.unity.remote-config@1.3.2-preview.2\Runtime\ConfigManager.cs:252)
I/Unity ( 7043): UnityEngine.AsyncOperation:InvokeCompletionEvent() (at /Users/bokken/buildslave/unity/build/Runtime/Export/Scripting/AsyncOperation.cs:21)
as you can see, the log line 12 shows that the retrieved IP is empty. This is the result I got on version 2.0.0, 1.4.0 and 1.3.2-preview2
Forgot to mention, one of my coleagues found this one.
For those who also use Proguard / other obfuscation tools and encountered issues with platform detection:
Make sure to exclude properties / classes you’re using for rules / determining platforms.
Otherwise Remote Config will not detect platform correctly.
Would you please elaborate more on excluding properties / classes used for rules / determining platforms?