Exemple #1
0
    private void Awake()
    {
        if (GameObject.FindGameObjectsWithTag("MainCamera").Length > 1)
        {
            // Destroy any extra cameras.
            Destroy(transform.parent.gameObject);
        }

        CustomHelpers.CheckForInitializedFields(this);

        // DontDestroyOnLoad(gameObject);
        xOffset = thisCamera.orthographicSize * Screen.width / Screen.height;
        yOffset = thisCamera.orthographicSize;

        xMin = minBoundaryX.bounds.min.x + xOffset;
        xMax = maxBoundaryX.bounds.max.x - xOffset;
        yMin = minBoundaryY.bounds.min.y + yOffset;
        yMax = maxBoundaryY.bounds.max.y - yOffset;
    }