WebGL error

getting this error Pointer_stringify(ptrToSomeCString) when running in WebGL.

Ohayo! RimuruDev here :smiley:

The warning you’re encountering is related to the deprecated use of the Pointer_stringify function in Unity WebGL. This warning should not prevent your game from working by default, but it does indicate that a deprecated function is being used in Unity scripts, which will be removed in future Unity versions.

The errors look like this:

Pointer_stringify(ptrToSomeCString)

or

The JavaScript function 'Pointer_stringify(ptrToSomeCString)' is obsoleted and will be removed in a future Unity version. Please call 'UTF8ToString(ptrToSomeCString)' instead. 

Here’s how you can fix it:

1. Updating Unity code:

  • Find all occurrences of Pointer_stringify in your Unity project’s code.
  • Replace them with UTF8ToString, as recommended in the error message.

2. Updating plugins or assets:

  • If this warning arises from external assets or plugins, check for updates that might resolve this warning.

But how do you find where you used Pointer_stringify? :thinking:

And if you didn’t use Pointer_stringify, then how to determine where it is currently used? :thinking:

→ First - open the IDE with your project solution. Or click as shown in the picture:
image

→ Next are examples on Rider but it works similarly in any IDE, although the hotkeys may differ. My IDE is Rider with the IntelliJ Keymap:
image

→ Press the ctrl + shift + f combination, and a window will appear where you need to enter the name of the old function as shown below:

→ Click on the shown options and replace Pointer_stringify with UTF8ToString as shown in the screenshot. I highlighted the old function name Pointer_stringify and simply pasted UTF8ToString in its place.
image

image


In my case, since I never used Pointer_stringify anywhere, Rider indicated that the only calls are found in the file UnityWebSocketBridge.jslib, which is a JavaScript library used in Unity WebGL projects for interacting with web sockets.
image

I also made changes to it. And the error disappeared.

Once you’ve replaced all calls to Pointer_stringify functions with UTF8ToString in your project, save the project and rebuild it.

That’s it! This should help you solve your problem.

I translated this text from Russian to English. My English isn’t great, but I hope at least the screenshots make it clear how to solve your problem.

:heart: Wishing you all the best :heart: