unity web 交互

<script type="text/javascript">
<!--
var unityObjectUrl = "http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject2.js";
if (document.location.protocol == ‘https:‘)
unityObjectUrl = unityObjectUrl.replace("http://", "https://ssl-");
document.write(‘<script type="text\/javascript" src="‘ + unityObjectUrl + ‘"><\/script>‘);
-->
var _carName="X5";
var _isSUV="0";
var _tiltAngle=30;
var _climbingAngles=30;
var _wadingDepth=50;

function unityCar(){
u.getUnity().SendMessage("MainScript", "onCarName", _carName);
u.getUnity().SendMessage("MainScript", "onIsSUV", _isSUV);
u.getUnity().SendMessage("MainScript", "onTiltAngle", _tiltAngle);
u.getUnity().SendMessage("MainScript", "onClimbingAngles", _climbingAngles);
u.getUnity().SendMessage("MainScript", "onWadingDepth", _wadingDepth);
}
</script>

 

//////////////////////////////////////////////

Application.ExternalEval("window.close()");//在unity中输入可以直接关闭当前的页面

unity web 交互,布布扣,bubuko.com

unity web 交互

上一篇:[LeetCode 789.] 逃脱阻碍者]


下一篇:Console命令详解,让调试js代码变得更简单