Quantcast
Channel: Questions in topic: "webgl"
Viewing all articles
Browse latest Browse all 2390

Passing array of strings to native JavaScript plugin on WebGL

$
0
0
I'm working on integrating an API on a WebGL project, and I need to pass an array of strings to a native plugin. Here's a snippet of my native plugin code in **JavaScript**: WebGetValues: function(textIds) { opt_params = {}; var ids = {}; for (var i = 0; i < textIds.length; i++) { ids.push(Pointer_stringify(textIds[i])); console.log(Pointer_stringify(textIds[i])); } } I'm not seeing a console log, which leads me to believe that it's either not being passed in as an array or the data is invalid. Here's how I'm passing in the string array from **C#**: public void GetValues(IEnumerable textIds) { #if UNITY_WEBGL && !UNITY_EDITOR WebGetValues(textIds.ToArray()); return; #endif } I couldn't find anything in the [documentation](https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscripting.html) or anywhere online about passing in string arrays to native JS plugins. Is there a way to do this?

Viewing all articles
Browse latest Browse all 2390

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>