Esempio n. 1
0
    /// @note Each scene load causes an OnDestroy of the current SDK, followed
    /// by and Awake of a new one.  That should not cause the underlying native
    /// code to hiccup.  Exception: developer may call Application.DontDestroyOnLoad
    /// on the SDK if they want it to survive across scene loads.
    void Awake()
    {
        if (instance == null)
        {
            instance = this;

            // we sync in the TimeWarp, so we don't want unity syncing elsewhere
            QualitySettings.vSyncCount  = 0;
            Application.runInBackground = false;
            Input.gyro.enabled          = false;
            Application.targetFrameRate = 60;
            // Disable screen dimming
            Screen.sleepTimeout = SleepTimeout.NeverSleep;
        }
        if (instance != this)
        {
            Debug.LogError("There must be only one NvrViewer object in a scene.");
            UnityEngine.Object.DestroyImmediate(this);
            return;
        }

        InitDevice();
        AddPrePostRenderStages();

        device.AndroidLog("Welcome to use Unity NVR SDK , current SDK VERSION is " + NVR_SDK_VERSION + ", j " + NvrGlobal.jarVersion + ", s " + NvrGlobal.soVersion + ", u " + Application.unityVersion);
    }