File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments