定义unity3d鼠标有效活动区域
//定义鼠标有效区域JS调用DLL实例
Rect screenRect = new Rect(0,0,Screen.width,Screen.height);
if( !screenRect.Contains(Input.mousePosition)) return;
新建脚本,复制粘贴,哈啊哈:)
import System;
import System.Runtime.InteropServices;
@DllImport("user32.dll")
public static function MessageBox(Hwnd : int,text : String,Caption : String,iType : int) : int {};
function Start()
{
MessageBox(0, "API Message Box", "Win32 API", 64) ;
}
function Update () {
}
全屏幕播放视频的方法
全屏幕播放一段视频,并且视频可以根据屏幕大小自动缩放匹配。下面是代码:
var StartingMovie : MovieTexture;
function OnGUI () {
//影片放置的屏幕位置
GUI.DrawTexture (Rect (0,0, Screen.width, Screen.height),StartingMovie,ScaleMode.ScaleToFit );
StartingMovie.Play();
}