Skip to content

Commit

Permalink
Merge pull request #1 from Zingabopp/CameraPlus
Browse files Browse the repository at this point in the history
TransparentWalls working for CameraPlus
  • Loading branch information
Zingabopp authored Dec 11, 2018
2 parents 6020630 + 069002a commit 19a429d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions TransparentWall/TransparentWall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private IEnumerator<WaitForEndOfFrame> setupCamerasCoroutine()

StandardLevelSceneSetupDataSO levelSetup = Resources.FindObjectsOfTypeAll<StandardLevelSceneSetupDataSO>().FirstOrDefault();

Camera mainCamera = FindObjectsOfType<Camera>().FirstOrDefault(x => x.CompareTag("MainCamera"));
Camera mainCamera = Camera.main;

if (Plugin.IsHMDOn && levelSetup.gameplayCoreSetupData.gameplayModifiers.noFail)
mainCamera.cullingMask &= ~(1 << WallLayer);
Expand All @@ -99,7 +99,12 @@ private IEnumerator<WaitForEndOfFrame> setupCamerasCoroutine()
yield return new WaitForEndOfFrame();
_cameraPlus = ReflectionUtil.GetPrivateField<MonoBehaviour>(plugin, "_cameraPlus");
}
Camera cam = ReflectionUtil.GetPrivateField<Camera>(_cameraPlus, "_cam");
Camera cam = null;
while (cam == null) // Camera is null on the first attempt.
{
yield return new WaitForEndOfFrame();
cam = GameObject.FindObjectsOfType<Camera>().Where(c => c.name == "Camera Plus").FirstOrDefault();
}
if (cam != null)
{
if (((plugin.Name == "CameraPlus" || plugin.Name == "CameraPlusOrbitEdition") && Plugin.IsCameraPlusOn) || (plugin.Name == "DynamicCamera" && Plugin.IsDynamicCameraOn))
Expand Down

0 comments on commit 19a429d

Please sign in to comment.