Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

WebGL SendMessage - solved

Discussion in 'WebGL' 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. }