Skip to content

Commit

Permalink
Added Method to enable/disable the stacked camera
Browse files Browse the repository at this point in the history
In order to improve performances, this method will enable/disable the camera stacking based on the ClientSim Menu state.
  • Loading branch information
FairplexVR authored Oct 21, 2023
1 parent f0bc7e1 commit 56bc063
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Packages/com.vrchat.ClientSim/Runtime/System/ClientSimMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ private void ToggleMenu(bool isActive)
_menuIsActive = isActive;
menu.SetActive(isActive);

ToggleCameraStacking(isActive);

_eventDispatcher.SendEvent(new ClientSimMenuStateChangedEvent { isMenuOpen = _menuIsActive });

if (_menuIsActive)
Expand All @@ -293,6 +295,19 @@ private void ToggleMenu(bool isActive)
{
_eventDispatcher.Unsubscribe<ClientSimOnPlayerMovedEvent>(OnPlayerMoved);
}


}

private void ToggleCameraStacking(bool isActive)
{
if (_menuCanvas.worldCamera == null)
{
return;
}

Camera cam = _menuCanvas.worldCamera;
cam.enabled = isActive;
}

// TODO update position based on tracking type. Desktop should always be in front of the camera and VR
Expand Down Expand Up @@ -512,4 +527,4 @@ public void UpdateConsoleLogging(bool consoleLogging)

#endregion
}
}
}

0 comments on commit 56bc063

Please sign in to comment.