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

MissingMethodException with jslib calling c# functions

$
0
0
I am using jslib plugin to use websockets in a webgl build. Whenever I call a c# function from jslib I get an error: MissingMethodException: Client.OnMsg Due to: Attempted to access a missing member. at System.RuntimeType.InvokeMember (System.String name, System.Reflection.BindingFlags bindingFlags, System.Reflection.Binder binder, System.Object target, System.Object[] providedArgs, System.Reflection.ParameterModifier[] modifiers, System.Globalization.CultureInfo culture, System.String[] namedParams) [0x00000] in <00000000000000000000000000000000>:0 (Filename: currently not available on il2cpp Line: -1) My jslib code: window.wsclient.onmessage = function(evt) { console.log("[recv] "+evt.data); var buffer = _malloc(lengthBytesUTF8(evt.data)+1); stringToUTF8(evt.data, buffer, lengthBytesUTF8(evt.data)+1); unityInstance.SendMessage('MainPlayer', 'OnMsg', buffer); }; My c# code: bool firstMsg = true; public void OnMsg(string message) { if (firstMsg) { var msg = JsonUtility.FromJson(message.Split('}')[0] + "}"); firstMsg = false; } else { var msg = JsonUtility.FromJson(message.Split('}')[0] + "}"); } } Why am I getting this error in my builds?

Viewing all articles
Browse latest Browse all 2390

Trending Articles



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