using UnityEngine;
using System.Collections;
public class NewBehaviourScript : MonoBehaviour {
void OnGUI(){
if(GUI.Button(new
Rect(10,10,100,30),"点击")){
Application.ExternalCall
("MyFunction2", "Hello from Unity!");//web窗体显示Hello from
Unity
}
}
}
保存 发布成webplay形式
在html中
<title>Unity Web Player |
WebPlayer</title>
<script type="text/javascript" src="http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject.js"></script>
<script
type="text/javascript">
下边插入一下数据
function MyFunction2( arg )
{
alert( arg );
}
保存运行webplay