Unity3D发布成web形式后,可以通过 GetUnity().SendMessage("gameobj","function_name",value); 给u3d传递参数。不过,要注意的是在web中要等u3d加载完传值才能成功,所以要通过以下js程序以2秒时间循判断GetUnity()是否为空。
1: <script defer="defer">
2: var action= window.setInterval( "set_p()",2000);
3: function set_p()
4: {
5: if( GetUnity() == null)
6: {
7: return;
8: }
9: else
10: {
11: var id= document.getElementById("id").innerHTML;
12: GetUnity().SendMessage("Cam","get_id",id);
13: window.clearInterval(action);
14: }
15: }
16: </script>
17: <style type="text/css">