GameAnalytics / GA-SDK-UNITY

The GameAnalytics SDK for tracking events in Unity.
MIT License
120 stars 56 forks source link

GameAnalytics crashes with Unity 2023.2.12f1 [WebGL] #28

Open Hellfim opened 9 months ago

Hellfim commented 9 months ago

Unity removed support for the Pointer_stringify function, thus all code using it produces errors, i. e.:

ReferenceError: Pointer_stringify is not defined
    at _configureSdkGameEngineVersion
Sandrik8 commented 8 months ago

Hello , I have this issue too, is there any fix?

Edit, Found Fix : pointer_stringify() replacing with UTF8ToString()

reptiloyds commented 8 months ago

Hello , I have this issue too, is there any fix?

Edit, Found Fix : pointer_stringify() replacing with UTF8ToString()

Hi. How you did this?

Hellfim commented 8 months ago

Edit, Found Fix : pointer_stringify() replacing with UTF8ToString()

To apply this fix you need to fork this repo and manually update all Pointer_stringify into UTF8ToString. I wouldn't say it's a good way.

On my end I actually created a PointerStringify.jspre (you can name yours however you want) file in the Assets/Plugins folder with following content

if (typeof Pointer_stringify === "undefined") {
    Pointer_stringify = function (ptr, length) {
        return UTF8ToString(ptr);
    }
}

It declares Pointer_stringify function in the global scope if it's not declared. This way all requests from all plugins (including GA) which use that Obsolete method don't break and function properly.