Skip to content

Commit

Permalink
Fixed an error caused by not having a main camera
Browse files Browse the repository at this point in the history
  • Loading branch information
oneVR committed May 1, 2020
1 parent 2a57c36 commit e299865
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Scripts/Editor/WorldDebugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,25 @@ void CheckBakeryLight(GameObject obj)

#if UNITY_POST_PROCESSING_STACK_V2
PostProcessVolume[] PostProcessVolumes = FindObjectsOfType(typeof(PostProcessVolume)) as PostProcessVolume[];
if (!sceneDescriptor.ReferenceCamera && PostProcessVolumes.Length == 0 && !Camera.main.gameObject.GetComponent(typeof(PostProcessLayer)))
bool postProcessLayerExists = false;
if (Camera.main == null)
{
if (sceneDescriptor.ReferenceCamera)
{
if (sceneDescriptor.ReferenceCamera.gameObject.GetComponent(typeof(PostProcessLayer)))
{
postProcessLayerExists = true;
}
}
}
else
{
if (Camera.main.gameObject.GetComponent(typeof(PostProcessLayer)))
{
postProcessLayerExists = true;
}
}
if (!sceneDescriptor.ReferenceCamera && PostProcessVolumes.Length == 0 && !postProcessLayerExists)
{
postprocessingMessages.AddMessage(new DebuggerMessage(postProcessingImportedButNotSetup, MessageType.Info));
}
Expand Down

0 comments on commit e299865

Please sign in to comment.