Browse Source

Added a debug tool for dumping system info and making screenshots, and made the camera mover do something a little bit more interesting.

mac-autoexp
Nico de Poel 3 years ago
parent
commit
bececcdbc1
  1. 18
      Assets/Scenes/SampleScene.unity
  2. 3
      Assets/Scripts/CameraMover.cs
  3. 31
      Assets/Scripts/DebugDumper.cs
  4. 11
      Assets/Scripts/DebugDumper.cs.meta
  5. 2
      ProjectSettings/ProjectSettings.asset

18
Assets/Scenes/SampleScene.unity

@ -230,6 +230,7 @@ GameObject:
- component: {fileID: 963194226}
- component: {fileID: 963194229}
- component: {fileID: 963194230}
- component: {fileID: 963194231}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
@ -316,7 +317,6 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
qualityMode: 3
enableJitter: 1
--- !u!114 &963194230
MonoBehaviour:
m_ObjectHideFlags: 0
@ -329,8 +329,20 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: e3b91bb9659da8f49b7b36df73b7f70a, type: 3}
m_Name:
m_EditorClassIdentifier:
amplitude: 30
frequency: 0.1
amplitude: 20
frequency: 0.15
--- !u!114 &963194231
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0211abdb066e45843a6b64af75622c97, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &1313173313
PrefabInstance:
m_ObjectHideFlags: 0

3
Assets/Scripts/CameraMover.cs

@ -22,7 +22,8 @@ public class CameraMover : MonoBehaviour
void Update()
{
var angles = _startAngles;
angles.x = amplitude * Mathf.Sin(2 * Mathf.PI * frequency * Time.time);
angles.x += amplitude * Mathf.Sin(2 * Mathf.PI * frequency * Time.time);
angles.y += amplitude * Mathf.Sin(2 * Mathf.PI * frequency * Time.time * 0.73f);
_camera.transform.localEulerAngles = angles;
}
}

31
Assets/Scripts/DebugDumper.cs

@ -0,0 +1,31 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;
using UnityEngine;
public class DebugDumper : MonoBehaviour
{
void Start()
{
var sb = new StringBuilder("SystemInfo:\n");
foreach (var property in typeof(SystemInfo).GetProperties(BindingFlags.Static | BindingFlags.Public))
{
sb.AppendLine($"- {property.Name} = {property.GetValue(null)}");
}
Debug.Log(sb);
}
void Update()
{
if (Input.GetKeyDown(KeyCode.F12))
{
string path = Path.Combine(Directory.GetCurrentDirectory(), $"screenshot-{DateTime.Now:yyyyMMdd-HHmmss}.png");
ScreenCapture.CaptureScreenshot(path);
Debug.Log($"Screenshot saved to: {path}");
}
}
}

11
Assets/Scripts/DebugDumper.cs.meta

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0211abdb066e45843a6b64af75622c97
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

2
ProjectSettings/ProjectSettings.asset

@ -638,7 +638,7 @@ PlayerSettings:
allowUnsafeCode: 0
useDeterministicCompilation: 1
enableRoslynAnalyzers: 1
selectedPlatform: 4
selectedPlatform: 0
additionalIl2CppArgs:
scriptingRuntimeVersion: 1
gcIncremental: 1

Loading…
Cancel
Save