Skip to content

Commit 8b071dc

Browse files
committed
Add debug GUI
1 parent 12d3c9c commit 8b071dc

3 files changed

Lines changed: 408 additions & 65 deletions

File tree

Source/CameraWrapper.cs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
using System;
2+
using UnityEngine;
3+
4+
namespace RealSolarSystem
5+
{
6+
public class CameraWrapper
7+
{
8+
public string depth = string.Empty;
9+
public string farClipPlane = string.Empty;
10+
public string nearClipPlane = string.Empty;
11+
public string camName = string.Empty;
12+
13+
public void Apply()
14+
{
15+
Camera[] cameras = Camera.allCameras;
16+
17+
try
18+
{
19+
bool notFound = true;
20+
21+
foreach (Camera cam in cameras)
22+
{
23+
if (camName.Equals(cam.name))
24+
{
25+
if (float.TryParse(depth, out float ftmp))
26+
cam.depth = ftmp;
27+
28+
if (float.TryParse(farClipPlane, out ftmp))
29+
cam.farClipPlane = ftmp;
30+
31+
if (float.TryParse(nearClipPlane, out ftmp))
32+
cam.nearClipPlane = ftmp;
33+
34+
depth = cam.depth.ToString();
35+
nearClipPlane = cam.nearClipPlane.ToString();
36+
farClipPlane = cam.farClipPlane.ToString();
37+
38+
notFound = false;
39+
}
40+
}
41+
42+
if (notFound)
43+
{
44+
Debug.Log($"[RealSolarSystem] Could not find camera {camName} when applying settings!");
45+
}
46+
}
47+
catch (Exception exceptionStack)
48+
{
49+
Debug.Log($"[RealSolarSystem] Error applying to camera {camName}: exception {exceptionStack.Message}");
50+
}
51+
}
52+
}
53+
}

0 commit comments

Comments
 (0)