After learning about Remote Config at Dev Day LA today, I’m integrating it into my current project.
After some initial confusion between Remote Config and the very-similar-but-deprecated Remote Settings, I’ve got it working, however when I run it the FetchCompleted callback is getting called twice; once with empty data before my ConfigManager.FetchConfigs call, and once with all the expected data as a result of that call.
Where is that extra call coming from, and can I kill it so I don’t get that empty data?
is the first call coming back with remote? If so, are you doing on Awake? My guess is that the first call is for the legacy Remote Settings (games by default will do this). I can investigate further once I’m back in the office on Tuesday.
If that’s the issue, we’re hoping it’ll be resolved in a future package version where we decouple from the engine APIs for Remote Settings and Remote Config.
I had my call in Start rather than Awake because I wanted to make sure some things initialized in their own Awakes before it fired. If I move it to Awake then I still get two calls, but the first is cached and the second is remote, and I don’t see that blank data callback. Not sure why that fixes it?
I want to confirm that you are using the code here Code integration | Remote Config | 1.0.9 ? Can you elaborate what you mean by “cached callback” and “blank remote callback”
yeah, I’m using ApplyRemoteSettings code that’s identical to what’s in that example (except with my values instead of those provided). “cached callback” = ApplyRemoveSettings with ConfigOrigin.Cached, and “blank remote callback” = ApplyRemoveSettings with ConfigOrigin.Remote, but all the values in ConfigManager.appConfig are blank.
Okay so did some investigation on our end, and this seems to be due to the in-engine APIs we’re using currently. They’re also used by the older Remote Settings system. We’ll be shipping a new version of the package in the next month or so that de-couples completely from the engine APIs that’ll solve the weirdness with these call orderings.
I guess in the meantime, were you able to get things working? If not, I’m more than happy to hop on a call with you and see what’s going on.
yep, I was able to get it working via that weird configuration I mentioned at the end of my investigations above, which I’ll un-weird once the fix arrives.
Thanks for the quick replies and for looking into this!
Now I need to track down the “Input System Rambod” for my current Input System woes…
Hi, i have the same issue, copy/paste code from documents page, then duplicate fetching happen
// Retrieve and apply the current key-value pairs from the service on Awake:
void Awake () {
// Add a listener to apply settings when successfully retrieved:
ConfigManager.FetchCompleted += ApplyRemoteSettings;
// Fetch configuration setting from the remote service:
ConfigManager.FetchConfigs<userAttributes, appAttributes>(new userAttributes(), new appAttributes());
}
void ApplyRemoteSettings (ConfigResponse configResponse) {
// Conditionally update settings, depending on the response's origin:
switch (configResponse.requestOrigin) {
case ConfigOrigin.Default:
Debug.Log ("Load fail! Use DEFAULT");
break;
case ConfigOrigin.Cached:
Debug.Log ("Load fail! Use Cached");
break;
case ConfigOrigin.Remote:
Debug.Log ("Success Load Settings From Server!");
break;
}
}
Btw: I think it is still working without any problem, cause it’s still load success on 2nd.
Make sure you select Show preview packages from the Advanced dropdown in the Package Manager UI. The latest I see as of today is 2.0.1 published Dec 12, I’m using Unity 2019.4.1f1
Pointed out because the verified versions tend to be much more safer and I want to add this feature to a released game. As much as the new version may work on my side/testers side, I don’t know every little details in the package that may bring harm in different scenarios, as much as the developers who wrote it.
still same issue. im getting called 2 times in latest unity 2020.3 version with FetchCompleted calling 2 times.unity please fix this.remote config version 2.1.2