Search Unity

WebGL SendMessage - solved

Discussion in 'Web' started by quaigon, Sep 24, 2015.

  1. quaigon

    quaigon

    Joined:
    Aug 16, 2013
    Posts:
    8
    There ist no SendMessage("MyGameObject","MyFunction","SomeValue") - Function in UnityConfig.js anymore?

    Now, how can I interact with the unity-scene from the html-page, without custom URL parameters? Or have i missed something?

    (Unity 5.2.1f1)


    edit: however, it works now with SendMessage("MyGameObject","MyFunction","SomeValue") from html-function
     
    Last edited: Sep 25, 2015
  2. Zaelot

    Zaelot

    Joined:
    Mar 26, 2015
    Posts:
    12
    It's in the build_name.js these days:
    Code (JavaScript):
    1. function SendMessage(gameObject,func,param {
    2.     if(param===undefined)Module.cwrap("SendMessage","void",["string","string"])(gameObject,func);
    3.     else if(typeof param==="string")Module.cwrap("SendMessageString","void",["string","string","string"])(gameObject,func,param);
    4.     else if(typeof param==="number")Module.cwrap("SendMessageFloat","void",["string","string","number"])(gameObject,func,param);
    5.     else throw""+param+" is does not have a type which is supported by SendMessage."
    6. }