Unity communication with browser problem


I'm trying to communicate with browser via unity. My scene contains a camera with a moving script attached. What i want to send is a simple communicate "true" to disable moving camera.

//Move2.js var speed = 5.0; var stopMe = "false"; function Update () { if(this.stopMe =="false"){ var x = Input.GetAxis("Horizontal") * Time.deltaTime * speed; var z = Input.GetAxis("Vertical") * Time.deltaTime * speed; transform.Translate(x, 0, z); } } function setStop(stop2 : String) { this.stopMe = stop2; }

So one setter called when i push button in html. GetUnity().SendMessage("Main Camera", "setStop", "true"); But nothing happening. Same thing when i'm trying to call javascript from application by putting ExternalCall at the begining of my Move2.js.

the application class methods can be called everywhere just like other static and none static methods. there should be another problem. for example maybe you changed the "jump" key input settings of your built application. also i think it can be a bug if you use IE8 on windows. first check if there is any error in your code. then put another statement inside the if's body to see the result. maybe for some reason the body of your if never executes. maybe there is an error in your javascript code inside the HTML file. put a document.write in it to see if it's called or not.

I still have a problem with Application.ExternalCall. I have written a script that if spacebar is pressed it is sending a message to the browser, and it is not working. Seems that my webapp after build has a problem with Application class. When i'm using any Application functions they are not working. It works only in Unity development IDE. Can someone tell me where should i use Application static functions? Now i'm calling it in Update(). My Code: function Update(){ if (Input.GetButtonDown("Jump")) Application.ExternalCall ("MyFunction1"); } }

Thank you for interest :). Yes, you are right there was some another probem with the scene or my project workspace, but again i don't know what it was. I've found a unity chat example and it works great even when i added some stuff. In the old workspace i've checked the unity console and it looks ok. I don't know how to debug the webplayer build so i really can't tell why it wasn't working. Anyway i've created new workspace and there everything is fine. New plane, new cube with javascript component function onMouseDown attacheted. It works. Thanks again.