如何获取unitywebplayer插件版网页post数据
发布网友
发布时间:2022-05-06 13:36
我来回答
共1个回答
热心网友
时间:2023-10-09 19:48
<script type="text/javascript" src="http://wp-china.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject.js"</script>
2. <script type="text/javascript">
3. <!--
4. function GetUnity() {
5. if (typeof unityObject != "undefined") {
6. return unityObject.getObjectById("unityPlayer");
7. }
8. return null;
9. }
10. if (typeof unityObject != "undefined") {
11. var params = {
12. autoupdateURL : "http://wp-china.unity3d.com/autodownload_webplugin-3.x",
13. autoupdateURLSignature : "02a5f78b3066d7d31fb063186a2eec36fdf1205d49c6b0808eb37ef85ed9902e2e1904d87f599238a802ba0abbfe4f18aa82dd2eb5171e99ba839a5cea9e6ea9c1be9eae505937b56fe4a5fd254cffe08958d961f42d970136b5eab9e6c2cd08b81bc8a11e5ade57dc63dcfef2248d89689e4d4feed3cdfe7374c848fd57ebd4"
14. };
15.
16. unityObject.setBaseDownloadUrl(http://wp-china.unity3d.com/download_webplayer-3.x/);
17. unityObject.embedUnity("www.hbbz08.com unityPlayer", "WebPlayer.unity3d", 600, 450, params);
18. }
19. -->
20. </script>
21. <body>
22. ...
23. <a href=http://unity3d.com/webplayer/ title="Unity Web Player. Install now!">
24. <img alt="Unity Web Player. Install now!" src=http://wp-china.unity3d.com/installation/getunity.png width="193" height="63" />
25. </a>
26. ...
27. </body>
在以上脚本中,特别需要强调的是从wp-china.unity3d.com中下载的UnityObject.js文件,该文件需要传入autoupdateURL/autoupdateURLSignature两个参数;同时还需设置好基础的下载地址(setBaseDownloadUrl),从而保证UnityObject中用到的任何文件(例如图像文件)也都会从wp-china.unity3d.com进行下载。同时,embedUnity函数中需要传入params参数。在body中,getunity.png的下载地址也需要更改为ChinaCache地址。