Ejemplo n.º 1
0
    /// <summary>
    /// Verify that all required parameters have been correctly defined, showing a specific error and
    /// returning false if not.
    /// </summary>
    private bool VerifyParameters()
    {
        // Verify this scene has a main Camera.
        if (Camera.main == null)
        {
            Debug.LogError(ExampleErrors.NullMainCamera(this, "to keep the AR Compass Map in front of"));
            return(false);
        }

        // Verify a Background UI element has been given, and that it has a default texture (to use as
        // a backup if augmented reality mode is not available).
        if (Background == null)
        {
            Debug.LogError(ExampleErrors.MissingParameter(this, Background, "Background",
                                                          "to show the real world background on device"));
            return(false);
        }
        if (Background.texture == null)
        {
            Debug.LogErrorFormat("No default texture applied to {0}, defined as {1}.{2}.Background.\n"
                                 + "This UI element must have a default texture to use if AR mode is not available on "
                                 + "device.",
                                 Background.name, name, GetType());
            return(false);
        }

        // If we have reached this point then we have verified that all required parts are present and
        // properly setup.
        return(true);
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Verify that all required parameters have been correctly defined, returning false if not.
    /// </summary>
    private bool VerifyParameters()
    {
        // Verify that a Ground plane has been given.
        if (Ground == null)
        {
            Debug.LogError(ExampleErrors.MissingParameter(this, Ground, "Ground"));
            return(false);
        }

        // Verify that there is a Camera.main in the scene (i.e. a Camera that is tagged: "MainCamera").
        if (Camera.main == null)
        {
            Debug.LogError(ExampleErrors.NullMainCamera(this));
            return(false);
        }

        // If have reached this point then we have verified all required parameters.
        return(true);
    }