Question by
mtsi_tims · Dec 21, 2016 at 06:47 PM ·
javascriptwebgl
How does the SendMessage function in WebGL JavaScript work?
The manual says I can call methods in Unity from JavaScript in my browser using SendMessage:
SendMessage ('MyGameObject', 'MyFunction', 'foobar');
However, I'm really confused about how to use this function; there are no details in the manual. In Unity, methods are part of scripts attached as components to Game Objects. A Game Object doesn't have functions, so how do I define the component that has the script with the method I want to call?
Also, for the last field, is it always passed as a string, or could I pass numbers or booleans too?
Comment