Unity Analytics WebGL compiler error

Hi,

I’m trying to integrate Unity Analytics on my project. I have successfully integrated it on Android and iOS, but when I switch to WebGL I get a compiler error:

Assets/Plugins/UnityAnalytics/WebGLWrapper.cs(4,39): error CS0246: The type or namespace name `BasePlatformWrapper’ could not be found. Are you missing a using directive or an assembly reference?

The issue is that in the PlatformWrapper.cs there is a precompilation check with the unity versions, but it doesn’t have the UNITY_5_2 check. It’s like this:

#if(UNITY_IPHONE||UNITY_ANDROID||UNITY_STANDALONE||UNITY_WEBPLAYER||UNITY_WEBGL||UNITY_METRO)&&(UNITY_4_2||UNITY_4_3||UNITY_4_4||UNITY_4_5||UNITY_4_6||UNITY_4_7||UNITY_4_8||UNITY_4_9||UNITY_5_0||UNITY_5_1)

where it should be:

#if(UNITY_IPHONE||UNITY_ANDROID||UNITY_STANDALONE||UNITY_WEBPLAYER||UNITY_WEBGL||UNITY_METRO)&&(UNITY_4_2||UNITY_4_3||UNITY_4_4||UNITY_4_5||UNITY_4_6||UNITY_4_7||UNITY_4_8||UNITY_4_9||UNITY_5_0||UNITY_5_1||UNITY_5_2)

I’m using Unity 5.2.0f3 with the latest Unity Analytics 1.9.5 (downloaded from the Asset Store).

Is anyone more having this issue? Is there a side effect if I fix the error changing the PlatformWrapper.cs class.

Thanks in advance,

Hi @felipeerpk ,

The 1.9.5 SDK was only intended to be used up to Unity version 5.1 so it has not been tested on 5.2. For versions 5.2 and above, Analytics is now integrated directly into the editor. Can you try reintegrating with the editor integrated version of Analytics and see if that resolves your issue? Here is a link with some information about reintegrating, Upgrade Unity Analytics 5.1 to 5.2 - Unity Services - Unity Discussions

If you are still having trouble after the reintegration you can open a support ticket here, Unity Cloud and we will see if we can resolve this for you.

Hi @mpinol ,

Reintegrating Unity Analytics with the editor version solves the issue! It now works for all the platforms (iOS, Android and WebGL).

Thanks a lot,

1 Like