- Home /
Browser to webplayer communication problem
Hi, I'm trying to send a string to my unity web player but I can't get it to work. I'm strictly following a couple of tutorials. Here's my code:
HTML:
<script type="text/javascript" language="javascript">
<!--
function initValues()
{
var unity = GetUnity();
unity.first.SendMessage("BCMenu", "initVals", "Hello!");
document.title="CENAÇA";
}
window.onload = initValues;
-->
</script>
Unity script:
function initVals (param : String)
{
GUI.Label(Rect(10,50,150,20),param);
}
I got my webplayer page running on the localhost serverand I'm running it with Mozilla Firefox and Google Chrome. The target object and script I'm trying to interact have the same name "BCMenu" and the function is named "initVals".
Can someone figure what am I doing wrong?
Thanks in advance.
Your answer
![](https://koobas.hobune.stream/wayback/20220613074321im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity vertex limit BUT with the Web Player ? 0 Answers
Concerns about browser security due to making javascript calls to game from browser. 1 Answer
How to send textures native ptr from web player to NPAPI browser plugin? 1 Answer
Web player caching is not happening in only Safari browser. 0 Answers
Loading Unity3d web player as a separate Pop-up window 1 Answer