雨亭

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
    void Start(){
        Rect screenRect  = new Rect(0, 0, Screen.width, Screen.Height); 
    }
    
    void Update{
        Vector3 screenPos = targetCamera.WorldToScreenPoint(objTrans.position);
        if(!screenRect.Contains(screenPos)){
            //do what you want
            Debug.log("Obj has gone out of screen...");
        }
    }

 

posted on 2014-11-11 11:09  雨亭  阅读(316)  评论(0编辑  收藏  举报