예제 #1
0
 static void Postfix(SNCameraRoot __instance, Camera ___mainCamera)
 {
     if (___mainCamera != null)
     {
         Object.DestroyImmediate(__instance.gameObject.GetComponent <AudioListener>());
         Object.DestroyImmediate(__instance.gameObject.GetComponent <StudioListener>());
         ___mainCamera.gameObject.AddComponent <StudioListener>();
     }
 }
        public static void SNCam_Awake_Postfix(SNCameraRoot __instance)
        {
            GameObject gameObject = __instance.transform.Find("MainCamera").gameObject;

            if (gameObject != null)
            {
                UnityEngine.Object.DestroyImmediate(__instance.gameObject.GetComponent <AudioListener>());
                UnityEngine.Object.DestroyImmediate(__instance.gameObject.GetComponent <StudioListener>());
                gameObject.AddComponent <StudioListener>();
            }
        }
예제 #3
0
            //Surround sound was not working right since there were two audio listener components attached to the main camera
            //Can't remember why I had to remove both before adding back just the StudioListener.
            //Should probably check if using Destroy instead of DestroyImmediate would work since it is supposed to be safer.
            static void Postfix(SNCameraRoot __instance)
            {
                GameObject mainCamera = __instance.transform.Find("MainCamera").gameObject;

                if (mainCamera != null)
                {
                    //UnityEngine.Object.DestroyImmediate(__instance.gameObject.GetComponent<AudioListener>());
                    //UnityEngine.Object.DestroyImmediate(__instance.gameObject.GetComponent<StudioListener>());
                    UnityEngine.Object.DestroyImmediate(mainCamera.GetComponent <AudioListener>());
                    UnityEngine.Object.DestroyImmediate(mainCamera.GetComponent <StudioListener>());
                    mainCamera.AddComponent <StudioListener>();
                }
            }