Skip to content

Commit

Permalink
Add debug GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
siimav committed Sep 3, 2023
1 parent 12d3c9c commit 8b071dc
Show file tree
Hide file tree
Showing 3 changed files with 408 additions and 65 deletions.
53 changes: 53 additions & 0 deletions Source/CameraWrapper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System;
using UnityEngine;

namespace RealSolarSystem
{
public class CameraWrapper
{
public string depth = string.Empty;
public string farClipPlane = string.Empty;
public string nearClipPlane = string.Empty;
public string camName = string.Empty;

public void Apply()
{
Camera[] cameras = Camera.allCameras;

try
{
bool notFound = true;

foreach (Camera cam in cameras)
{
if (camName.Equals(cam.name))
{
if (float.TryParse(depth, out float ftmp))
cam.depth = ftmp;

if (float.TryParse(farClipPlane, out ftmp))
cam.farClipPlane = ftmp;

if (float.TryParse(nearClipPlane, out ftmp))
cam.nearClipPlane = ftmp;

depth = cam.depth.ToString();
nearClipPlane = cam.nearClipPlane.ToString();
farClipPlane = cam.farClipPlane.ToString();

notFound = false;
}
}

if (notFound)
{
Debug.Log($"[RealSolarSystem] Could not find camera {camName} when applying settings!");
}
}
catch (Exception exceptionStack)
{
Debug.Log($"[RealSolarSystem] Error applying to camera {camName}: exception {exceptionStack.Message}");
}
}
}
}
Loading

0 comments on commit 8b071dc

Please sign in to comment.