Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Unity interact with Browser - Calling Functions

Discussion in 'Editor & General Support' started by alphakanal, May 19, 2020.

  1. alphakanal

    alphakanal

    Joined:
    Jan 21, 2013
    Posts:
    52
    Hi!
    I'm fooling around how to get a function in my HTML Document called from within a Unity WebGL application - but i can't get it running.

    My Code in Unity Plugin JSLib looks like this:
    Code (CSharp):
    1. mergeInto(LibraryManager.library, {
    2.  
    3.     ShowModal: function (){
    4.        
    5.         $.magnificPopup.open('myModal1');
    6.     },
    7.  
    8.     TriggerFunction: function (){
    9.         $(document).ready(function(){
    10.     $.test()});}
    11.     ,
    12.  
    13.     ShowMessage: function (message) {
    14.         window.alert(Pointer_stringify(message));
    15.     },
    16.  
    17. });
    The window.alert works fine but ShowModal and TriggerFunction doesn't

    I've read the documentation but there are only functions called already made in my unity project. But how to call function that are written in my HTML document - in example some jquery modals or popups etc?
    Any ideas ?
     
  2. alphakanal

    alphakanal

    Joined:
    Jan 21, 2013
    Posts:
    52
    solved - script order was the causing the problem
     
unityunity