private void CheckResource() { eventSystemObject = FindObjectOfType <EventSystem>(); if (eventSystemObject == null) { var es = new GameObject("EventSystem", typeof(EventSystem)); es.AddComponent <VRDebugInputModule>(); } else { var eventObj = eventSystemObject.gameObject; var comp = eventObj.GetComponent <VRDebugInputModule>() ?? eventObj.AddComponent <VRDebugInputModule>(); } if (vrLogWindow == null) { var obj = FindObjectOfType <VRLogWindow>(); if (obj == null) { vrLogWindow = Resources.Load("VRLogWindow") as GameObject; vrLogWindow = (GameObject)Instantiate(vrLogWindow); vrLogWindow.name = "VRLogWindow"; } else { vrLogWindow = obj.gameObject; } } scrollView = scrollView ?? vrLogWindow.transform.FindChild("MainWindow/ScrollView").GetComponent <VRDebugScrollView>(); setting = setting ?? this.GetComponent <VRDebugSetting>(); }
/// <summary> /// Update /// </summary> public override void Process() { setting = setting ?? GameObject.Find("VRDebug").GetComponent <VRDebugSetting>(); if (setting.GetOparateController == null) { return; } SendInputEvent(GetVRPointerEventData()); }
// Update is called once per frame void Update() { if (windowData != null) { setting = setting ?? GameObject.Find("VRDebug").GetComponent <VRDebugSetting>(); if (EditorApplication.isPlaying) { //Bind if (setting.GetIsBind) { if (!setting.SetGetIsGrab) { this.transform.SetParent(Camera.main.transform); } } else { this.transform.SetParent(null); } } if (setting.GetIsBillboard) { var vec = this.transform.position - Camera.main.transform.position; this.transform.rotation = Quaternion.LookRotation(vec); } else { localEulerAngles = this.transform.localEulerAngles; worldEulerAngle = this.transform.eulerAngles; } localPosition = this.transform.localPosition; worldPosition = this.transform.position; //サイズ調整 var w = Mathf.Max(0.5f, rectTransform.sizeDelta.x); var h = Mathf.Max(0.5f, rectTransform.sizeDelta.y); rectTransform.sizeDelta = new Vector2(w, h); sizeDelta = rectTransform.sizeDelta; //Debug.Log(sizeDelta); windowData.localPosition = localPosition; windowData.localEulerAngles = localEulerAngles; windowData.worldPosition = worldPosition; windowData.worldEulerAngle = worldEulerAngle; windowData.sizeDelta = sizeDelta; } if (boxCollider != null) { boxCollider.size = new Vector3(rectTransform.sizeDelta.x, rectTransform.sizeDelta.y, 0); } else { boxCollider = this.gameObject.GetComponent <BoxCollider>(); } }
// Use this for initialization void Awake() { setting = setting ?? GameObject.Find("VRDebug").GetComponent <VRDebugSetting>(); if (trackedObject == null) { trackedObject = setting.GetGrabController.GetComponent <SteamVR_TrackedObject>(); device = SteamVR_Controller.Input((int)trackedObject.index); } sphereCollider = this.GetComponent <SphereCollider>(); }