Skip to content

Commit b3dca84

Browse files
committed
Added cam_ortho and cam_fov commands.
1 parent 894db9e commit b3dca84

1 file changed

Lines changed: 73 additions & 13 deletions

File tree

Runtime/DevConsoleMono.cs

Lines changed: 73 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -892,19 +892,6 @@ private void InitBuiltInCommands()
892892
() => Log($"Application path: {AppDomain.CurrentDomain.BaseDirectory}.")
893893
));
894894

895-
AddCommand(Command.Create<int>(
896-
"fps_target",
897-
"fps_max",
898-
"Query or set the target frame rate.",
899-
Parameter.Create("targetFrameRate", "Frame rate the application will try to render at."),
900-
i =>
901-
{
902-
Application.targetFrameRate = i;
903-
LogSuccess($"Target frame rate set to {i}.");
904-
},
905-
() => LogVariable("TargetFrameRate", Application.targetFrameRate)
906-
));
907-
908895
#endregion
909896

910897
#region Screen commands
@@ -948,6 +935,79 @@ private void InitBuiltInCommands()
948935
() => LogVariable("Resolution", Screen.currentResolution)
949936
));
950937

938+
AddCommand(Command.Create<int>(
939+
"fps_target",
940+
"fps_max",
941+
"Query or set the target frame rate.",
942+
Parameter.Create("targetFrameRate", "Frame rate the application will try to render at."),
943+
i =>
944+
{
945+
Application.targetFrameRate = i;
946+
LogSuccess($"Target frame rate set to {i}.");
947+
},
948+
() => LogVariable("TargetFrameRate", Application.targetFrameRate)
949+
));
950+
951+
#endregion
952+
953+
#region Camera commands
954+
955+
AddCommand(Command.Create<bool>(
956+
"cam_ortho",
957+
"",
958+
"Query or set whether the main camera is orthographic",
959+
Parameter.Create("enabled", "Whether the main camera is orthographic"),
960+
b =>
961+
{
962+
if (Camera.main == null)
963+
{
964+
LogError("Could not find the main camera.");
965+
return;
966+
}
967+
968+
Camera.main.orthographic = b;
969+
LogSuccess($"{(b ? "Enabled" : "Disabled")} orthographic mode on the main camera.");
970+
},
971+
() =>
972+
{
973+
if (Camera.main == null)
974+
{
975+
LogError("Could not find the main camera.");
976+
return;
977+
}
978+
979+
LogVariable("Orthographic", Camera.main.orthographic);
980+
}
981+
));
982+
983+
AddCommand(Command.Create<int>(
984+
"cam_fov",
985+
"",
986+
"Query or set the main camera field of view",
987+
Parameter.Create("fieldOfView", "Field of view"),
988+
f =>
989+
{
990+
if (Camera.main == null)
991+
{
992+
LogError("Could not find the main camera.");
993+
return;
994+
}
995+
996+
Camera.main.fieldOfView = f;
997+
LogSuccess($"Main camera's field of view set to {f}.");
998+
},
999+
() =>
1000+
{
1001+
if (Camera.main == null)
1002+
{
1003+
LogError("Could not find the main camera.");
1004+
return;
1005+
}
1006+
1007+
LogVariable("FieldOfView", Camera.main.fieldOfView);
1008+
}
1009+
));
1010+
9511011
#endregion
9521012

9531013
#region Scene commands

0 commit comments

Comments
 (0)