Example #1
0
    private void ShowCompleteIconName()
    {
        if (iconName.EndsWith("..."))
        {
            Vector3 cursorPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            cursorPosition.z = 0;
            cursorPosition.x = Mathf.Clamp(cursorPosition.x, -5.4f, 5.4f);
            cursorPosition.y = Mathf.Clamp(cursorPosition.y + 0.2f, -4f, 4f);
            windowGameObject = Instantiate(completeNameWindow, cursorPosition, Quaternion.identity) as GameObject;

            GameObject windowBackground = windowGameObject.transform.GetChild(0).gameObject;

            windowGameObject.GetComponent <TextMesh>().text = fileExplorer.FormatCompleteName(iconCompleteName);
            windowGameObject.AddComponent <BoxCollider>();
            BoxCollider windowCollider     = windowGameObject.GetComponent <BoxCollider>();
            Vector3     colliderDimensions = windowCollider.size;
            windowCollider.enabled = false;
            windowBackground.transform.localScale = new Vector3(colliderDimensions.x / 2.2f, colliderDimensions.y / 2, colliderDimensions.z);
        }
    }