I’m using Unity 2021.2.11f and I’ve just enabled Cloud Diagnostics and added the User Reporting SDK.
Haven’t changed a thing but when I start or stop play mode, this error occurs:
These are the 340-341 lines of UserReportingScript
The sdk will be released as a package manager package somewhere soon where this is fixed. We either stay with the old one or wait for the new one to be released.
Hello, any ETA about how ‘soon’ can we expect the package to appear ?
Isn’t it problematic that the current one to download is flawed with that memory leak ? How to revert to the ‘old one’ ?
Thanks
Edit: There is currently only the flawed one, the new is not yet released and maybe, who knows, it may never will. Maybe Unity wants us to pay for an advanced version and bury the old one.
^ Disposing on line 379 doesn’t work. Since webrequest is cached in postOperation and later f’s.
Instead try this:
Where you are initializing IUserReportingPlatform
Assembly assembly = Assembly.GetExecutingAssembly();
Type asyncUnityUserReportingPlatformType =
assembly.GetType("Unity.Cloud.UserReporting.Plugin.Version2018_3.AsyncUnityUserReportingPlatform");
if (asyncUnityUserReportingPlatformType != null)
{
object activatedObject = Activator.CreateInstance(asyncUnityUserReportingPlatformType);
IUserReportingPlatform asyncUnityUserReportingPlatform = activatedObject as IUserReportingPlatform;
if (asyncUnityUserReportingPlatform != null)
{
UnityUserReporting.Configure(asyncUnityUserReportingPlatform, this.GetConfiguration());
configured = true;
}
}
You can see you create an instance of this. Therefore you can also dispose of this. What I’ve done is to extend interface
public interface IUserReportingPlatform :IDisposable
It will give you error of those instances. In the dispose methods just set all the class fields to null.
For example:
In “UnityUserReportingPlatform.cs”
Hello, just to be clear, calling the dispose() is required at UnityUserReportingPlatform line 379, is that right ?
In any case, thanks a lot for helping, you’re very kind !
I can’t believe Unity team didn’t yet backported a fix for such a huge leak in an active LTS like 2021.3 X/.
I also seem to have to add a dispose method there (empty that is) in that script, it’s legit right ?
It doesn’t really matter if there is an empty method. Since it is required be implementing this interface now with dispose it needs to have it.
After that you need to call the DIspose() from somewhere (probably from the place you started creating IUserReportingPlatform) when you don’t need it anymore i.e. OnApplicationQuit()