Qualcomm_Snapdragon_VR_SDK SvrManager脚本简介(2)

public bool Initialized
    {
        get { return status.initialized; }
    }

    public bool IsRunning
    {
        get { return status.running; }
    }

    public bool DisableInput
    {
        get { return disableInput; }
        set { disableInput = value; }
    }

SvrManager中定一个三个属性。开发者可以通过SvrManager.Instance.Initialized判断当前SDK是否初始化完毕。

通过SvrManager.Instance.IsRunning判断SDK是否正常运行中。

void Awake()
	{
		if (!ValidateReferencedComponents ())
		{
			enabled = false;
			return;
		}
        RegisterListeners();
        Input.backButtonLeavesApp = true;
        Screen.sleepTimeout = SleepTimeout.NeverSleep;
        Application.targetFrameRate = -1;
    }


在Awake()方法中,首先判断了当前场景内SVR SDK环境是否正常,包括检测的head以及eye物体是否为空deng和SvrPlugin是否存在,具体代码如下:

bool ValidateReferencedComponents()
	{
		plugin = SvrPlugin.Instance;
		if(plugin == null)
		{
			Debug.LogError("Svr Plugin failed to load. Disabling...");
			return false;
		}

		if(head == null)
		{
			Debug.LogError("Required head gameobject not found! Disabling...");
			return false;
		}

		if(monoCamera == null && (leftCamera == null || rightCamera == null))
		{
			Debug.LogError("Required eye components are missing! Disabling...");
			return false;
		}

		return true;
	}

RegisterListener为注册事件监听函数。

Input.backButtonLeavesApp = true;设置返回键退出应用功能。

 Screen.sleepTimeout = SleepTimeout.NeverSleep;屏幕是否自动关闭

 Application.targetFrameRate = -1;设置app运行帧率。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值