Пример #1
0
    // Show GUI objects.

    /* void OnGUI() {
     *           float buttonWidth = 140f;
     *           float buttonHeight = 40f;
     *           float margin = 10f;
     *           if (
     *                   GUI.Button(
     *                           new Rect(
     *                                   Screen.width - buttonWidth - margin,
     *                                   Screen.height - buttonHeight - margin,
     *                                   buttonWidth,
     *                                   buttonHeight),
     *                           "Toggle transparency"
     *                           )
     *                   ) {
     *                   // 透過の ON/OFF ボタン
     *                   ToggleWindowTransparency();
     *           }
     *
     *   //if (this.onOpaquePixel)
     *   {
     *       GUI.color = new Color(pickedColor.r, pickedColor.g, pickedColor.b, 1f);
     *       Vector2 pos = Input.mousePosition;
     *       GUI.Label(
     *           new Rect(
     *               Screen.width - buttonWidth - margin,
     *               Screen.height - buttonHeight * 2 - margin * 2,
     *               buttonWidth,
     *               buttonHeight),
     *           string.Format("({0,4},{1,4})/({2,4},{3,4})", pos.x, pos.y, camRect.width, camRect.height) + (onOpaquePixel ? " *" : "")
     *           );
     *   }
     * }
     */


    /// <summary>
    /// 自分のウィンドウハンドルを見つける
    /// </summary>
    private void FindMyWindow()
    {
        // まず自分のウィンドウタイトルで探す
        if (title != "" || !window.FindHandleByTitle(title))
        {
            // 名前がダメならアクティブなウィンドウを取得
            window.FindHandle();
        }
    }