The question is answered, right answer was accepted
UnityObject2 not defined in WebGL jslib plugins?
Hi there - I'm trying to convert a game from the webplayer to webGL.
I read that the preferred way of talking with the browser is through plugins, so here's my plugin code:
var BrowserInfoPlugin = {
GetBrowserInfo: function()
{
var u = UnityObject2.instances[0];
var ua = u.getPlatformInfo();
ua.screenWidth = screen.width;
ua.screenHeight = screen.height;
return JSON.stringify(ua);
}
};
mergeInto(LibraryManager.library, BrowserInfoPlugin);
I'm getting an error in the built WebGL player that UnityObject2 is not defined. I can't find any information on how to fix this in a plugin...what should the course of action be here? Am I overcomplicating this and the information can be grabbed in Unity / C# directly instead perhaps?
Thanks
This seems to be more global than this - other non-plugin (Javascript) files can't find UnityObject2 either. How is this defined for WebGL projects?
Answer by z_blush · Jul 05, 2016 at 10:34 PM
Looks like this just doesn't exist in WebGL - I'll have to find another way to get at this information.