# 2023/5/17 專題報告 ###### tags: `專題會議` * 小夥伴顯示的方向錯誤 ```csharp using UnityEngine; public class PartnerView : MonoBehaviour { private GameObject partner; [SerializeField] private float yRotation; //改為自訂方向 public void Initialize(GameObject partner) { this.partner = partner; LoadPartner(); } private void LoadPartner() { GameObject visuals = Instantiate(partner); visuals.transform.SetParent(this.transform); visuals.transform.localPosition = Vector3.zero; visuals.transform.rotation = Quaternion.identity; visuals.transform.rotation = new Quaternion(0f, yRotation, 0f, 0f); } } ``` * 待機在顯示文字會自己跳下一個選擇 ```csharp! public class VROptionView : UnityEngine.UI.Selectable, ISubmitHandler, IPointerClickHandler, IPointerEnterHandler { private string m_NoResult = "沒反應"; //預設小孩沒反應的值 private void Update() { if (m_CurrentSeconds < m_MaxSeconds && !m_IsSelected) { m_CurrentSeconds += Time.deltaTime; m_Result = m_VoiceSystem.GetSoundText(); } else if (m_CurrentSeconds > m_MaxSeconds && !m_IsSelected) { if (m_LineText.Contains(m_Result) && m_Result.Length != 0) //不能寫 == 或 equal { Debug.Log("Contain " + m_LineText); InvokeOptionSelected(); ``` * 角色還沒到移動點就被傳送到雲霄飛車的 bug ```csharp! using Assets.Scripts.YarnSpinner_Extends; using System.Collections; using UnityEngine; using UnityEngine.Playables; public class PlayFacilityTrigger : MonoBehaviour { [SerializeField] private PlayableDirector playableDirector; [SerializeField] private Transform m_NextPlayerTransform; [SerializeField] private float seconds = 30f; private Transform m_PlayerTransform; private void OnTriggerEnter(Collider other) { // if (other.GetComponent<VRPlayerCharacter>()) { Debug.Log("Have VRPlayerCharacter."); if (other.GetComponent<VRPlayerCharacter>().Parent != null) { m_PlayerTransform = other.GetComponent<VRPlayerCharacter>().Parent.gameObject.transform; } else { m_PlayerTransform = other.gameObject.transform; } //發現 bug 後擺放的位置 playableDirector.Play(); StartCoroutine(TimelineComplete()); } //原本擺放的位置 //playableDirector.Play(); //StartCoroutine(TimelineComplete()); } private IEnumerator TimelineComplete() { yield return new WaitForSeconds(seconds); m_PlayerTransform.position = m_NextPlayerTransform.position; } } ``` * VR移動地板的顯示會一下顯現一下消失 * 將VR移動地板的 Y 軸設在一般草地地板的上方 * 語音文字辨識錯誤的問題 * VR位置會因為流程而卡在一個範圍無法移動 * 現改成可以自由移動 * UniStorm 的 PC 與 VR platform 切換沒有順利運作 ```csharp! namespace UniStorm.Utility { [CustomEditor(typeof(UniStormSystem))] [System.Serializable] public class UniStormEditor : Editor { public override void OnInspectorGUI() { if (GUILayout.Button("Apply Platform Settings")) { if (EditorUtility.DisplayDialog("Platform Controller", "Are you sure you want to apply the selected platform? This process cannot be undone.", "Yes", "Cancel")) { if (self.PlatformType == UniStormSystem.PlatformTypeEnum.Desktop) { ... } else if (self.PlatformType == UniStormSystem.PlatformTypeEnum.VR) { ... GUIUtility.ExitGUI(); //增加此行程式碼後 Editor 才能正常運作 } ... ``` * SteamVR 的程式會一直跳預設視窗顯示 ```csharp! namespace Valve.VR { [InitializeOnLoad] public class SteamVR_UnitySettingsWindow : EditorWindow { ... const bool recommended_ShowUnitySplashScreen = true; //原本的值為 false,改成 true 就不會在跳出來了 ... ```