###前提・実現したいこと
unity ver5.6.1にて、
GEARVRのボタンが無効(コリジョンなども無効)になっているので
有効にしたいです。
※ユニティ上は正常に動作いたします。
ビルドしたアンドロイド&GEARVRを使用すると
ボタンが無効になっている
※ver5.3までは問題ありませんでした。
※ユニティ初心者なので、専門的な事はわからないです。申し訳ないです。
###発生している問題・エラーメッセージ
ver5.3の時は問題ありませんでした。
エラーメッセージ 特になし
###該当のソースコード
using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; using System.Collections; // original >> https://forums.oculus.com/community/discussion/comment/219978/#Comment_219978 public class GVRLookInputModule : BaseInputModule { // public const int kLookId = -3; // public string submitButtonName = "Fire1"; public string controlAxisName = "Horizontal"; private PointerEventData lookData; private PointerEventData GetLookPointerEventData() { Vector2 lookPosition; lookPosition.x = Screen.width/2; lookPosition.y = Screen.height/2; if (lookData == null) { lookData = new PointerEventData(eventSystem); } lookData.Reset(); lookData.delta = Vector2.zero; lookData.position = lookPosition; lookData.scrollDelta = Vector2.zero; eventSystem.RaycastAll(lookData, m_RaycastResultCache); lookData.pointerCurrentRaycast = FindFirstRaycast(m_RaycastResultCache); m_RaycastResultCache.Clear(); return lookData; } private bool SendUpdateEventToSelectedObject() { if (eventSystem.currentSelectedGameObject == null) return false; BaseEventData data = GetBaseEventData (); ExecuteEvents.Execute (eventSystem.currentSelectedGameObject, data, ExecuteEvents.updateSelectedHandler); return data.used; } public override void Process() { // send update events if there is a selected object (important) SendUpdateEventToSelectedObject(); PointerEventData lookData = GetLookPointerEventData(); // use built-in enter/exit highlight handler HandlePointerExitAndEnter(lookData,lookData.pointerCurrentRaycast.gameObject); if (Input.GetMouseButtonDown (0)) { // if (Input.GetButtonDown (submitButtonName)) { // eventSystem.SetSelectedGameObject(null); if (lookData.pointerCurrentRaycast.gameObject != null) { GameObject go = lookData.pointerCurrentRaycast.gameObject; GameObject newPressed = ExecuteEvents.ExecuteHierarchy (go, lookData, ExecuteEvents.submitHandler); if (newPressed == null) { // submit handler not found, try select handler instead newPressed = ExecuteEvents.ExecuteHierarchy (go, lookData, ExecuteEvents.selectHandler); } if (newPressed != null) { // eventSystem.SetSelectedGameObject(newPressed); } } } if (eventSystem.currentSelectedGameObject && controlAxisName != null && controlAxisName != "") { float newVal = Input.GetAxis (controlAxisName); if (newVal > 0.01f || newVal < -0.01f) { AxisEventData axisData = GetAxisEventData(newVal,0.0f,0.0f); ExecuteEvents.Execute(eventSystem.currentSelectedGameObject, axisData, ExecuteEvents.moveHandler); } } } }
###試したこと
5.3でボタンが動作していたことを確認。
ほかのプロジェクトも5.3までは使用できておりました。
上記スクリプトを「Ebent System」に入れ、代わりに
「Standalone Input Module」のチェックをはずしております。
※5.3でも変えておりません。
###補足情報(言語/FW/ツール等のバージョンなど)
関係あるかどうかは不明ですが、
「Canvas」の「Render Mode」を「Woled Space」に変更しております。
※下記にて、そのような文言がございましたので関係あるのかも?
(念のため変更してビルド
http://madnesslabo.net/utage/?p=9498
あなたの回答
tips
プレビュー