Skip to content

Commit

Permalink
Fixed NullReferenceException error.
Browse files Browse the repository at this point in the history
  • Loading branch information
Snow1226 committed Mar 30, 2020
1 parent 8ae3c0b commit 6fda390
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
14 changes: 11 additions & 3 deletions CameraPlus/CameraUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,19 @@ string msg
return false;
}

public static void SetAllCamerCulling()
public static void SetAllCameraCulling()
{
foreach (CameraPlusInstance c in Plugin.Instance.Cameras.Values.ToArray())
try
{
c.Instance.SetCullingMask();
foreach (CameraPlusInstance c in Plugin.Instance.Cameras.Values.ToArray())
{
c.Instance.SetCullingMask();
}
}
catch (Exception ex)
{
Logger.Log($"Exception cameras culling! Exception:" +
$" {ex.Message}\n{ex.StackTrace}", LogLevel.Error);
}
}

Expand Down
2 changes: 1 addition & 1 deletion CameraPlus/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ private IEnumerator DelayedActiveSceneChanged(Scene from, Scene to)
// If any new cameras have been added to the config folder, render them
// if(to.name == )
CameraUtilities.ReloadCameras();
CameraUtilities.SetAllCamerCulling();

if (ActiveSceneChanged != null)
{
CameraUtilities.SetAllCameraCulling();
// Invoke each activeSceneChanged event
foreach (var func in ActiveSceneChanged?.GetInvocationList())
{
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Edit that file to configure CameraPlus:
## Movement Script
The sample script described in MovementScriptPath is located in the Beat Saber \ UserData \ CameraPlus \ Scripts folder.

# If ActiveInPauseMenu is set to false, there is a bug that the script doesn't return to its original state when SteamVR screen is displayed. #
### If ActiveInPauseMenu is set to false, there is a bug that the script doesn't return to its original state when SteamVR screen is displayed.
```xml
{
"ActiveInPauseMenu": true, "ActiveInPauseMenu": Determines whether the camera pauses when pausing the game.
Expand Down

0 comments on commit 6fda390

Please sign in to comment.