I have the same script fetching remote config on various objects, there are maybe 4 or 5 of them sitting in the scene.
void Awake()
{
text.text = "data incoming...";
ConfigManager.FetchCompleted += ApplyRemoteSettings;
ConfigManager.FetchConfigs<userAttributes, appAttributes>(new userAttributes(), new appAttributes());
}
Does each call to FetchConfigs
connect with the server?
Is it better to call FetchConfigs
once per scene and have other scripts ```
ConfigManager.FetchCompleted += ApplyRemoteSettings;
Reading ConfigManager.cs it seems that each FetchConfig sends a WebRequest and I’m not seeing any caching so I’d say optimizing this is up to us. correct?
May I ask, why don’t you combine everything into one request? Can you elaborate, sitting on the scene? In your code, you only have one. Or do you have each object calling that same code with that script attached to each object? You don’t need to do that, clearly, if it’s retrieving the same data each time. It would be better to have a single empty game object maybe called MyGameManager and put the Awake code once, in that object.
1 Like
Thanks for confirming there is no caching so I went ahead and added a static variable alreadyFetched to avoid double fetching.
Yes the remote config script is called on each gameobject.
You’re right that the clean way to do it is to centralize fetching but this way makes my work easy as I don’t use RC to tune enemy stats yet.
My point is that you only need to call it only once. Each call is retrieving the same data, not what you want and is not needed.