Quantcast
Channel: Questions in topic: "javascipt"
Viewing all articles
Browse latest Browse all 1875

WebGL + JSLIB Plugin, using functions

$
0
0
I've written a .jslib file in my /Assets/Plugins/WebGL folder that I am successfully calling back and forth with my C# code (using [DllImport ("__Internal")] in C# and SendMessage in JS). The only problem I'm running into is I have not found a way that I can add a function to my Javascript object that I can call from another JS function. Ex. var WebInteraction = { func1: function() { console.log("do func1 stuff"); func3(); }, func2: function(str) { console.log("do func2 stuff str=" + str); func3(); }, func3: function() { console.log("do func3 stuff"); } }; mergeInto(LibraryManager.library, WebInteraction); Code similar to the above example is giving me a func3 doesn't exist error. I also looked in the .js file that Unity outputs and confirmed func3 was not exported. I do see func1 and func2 as _func1() and _func2(). Is there a way to add functions into the jslib that are not intended to be called from the C# code? I've also tried calling the function like WebInteraction.func3(), as well as moving the function out of the WebInteraction object, but both did not get the compiler to export the func3().

Viewing all articles
Browse latest Browse all 1875

Trending Articles



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