Skip to content

Commit

Permalink
Adding automatic Screenshots when running with --benchmark argument (#11
Browse files Browse the repository at this point in the history
)

* Fix small sign error that causes division by zero (#8)

* Added Events and Scripts for Screenshots

* Updated Screenshots, Added FPS Manager in benchmark + Fixes in packages

Co-authored-by: Ludovic Theobald <[email protected]>
Co-authored-by: Thomas ICHÉ <[email protected]>
  • Loading branch information
3 people authored and GitHub Enterprise committed Dec 18, 2020
1 parent 75ab087 commit e5d2c5f
Show file tree
Hide file tree
Showing 9 changed files with 4,094 additions and 26 deletions.
3,407 changes: 3,396 additions & 11 deletions Assets/Animation/Benchmark/BenchmarkWalkthroughPart01Timeline.playable

Large diffs are not rendered by default.

445 changes: 445 additions & 0 deletions Assets/Animation/Benchmark/BenchmarkWalkthroughPart02Timeline.playable

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions Assets/BuildSettings/SpaceshipDemo/PC-Win64-Benchmark.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c7d5bb3f971603247917785e7ea66453, type: 3}
m_Name: PC-Win64-Benchmark
m_EditorClassIdentifier:
Name: Automated Benchmark (Release)
Category: PC
BuildPath: Build/Win64/Benchmark/
ExecutableName: Spaceship.exe
CleanupBeforeBuild: 1
RunWithArguments: --benchmark
Profile: {fileID: 11400000, guid: e4477d07ca6209547874cb1be39ae63d, type: 2}
SceneList: {fileID: 11400000, guid: dd790fd6ec20f15478b7a5c9a4052538, type: 2}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

189 changes: 175 additions & 14 deletions Assets/Prefabs/Benchmark/Benchmark.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ Transform:
- {fileID: 2844759636163112434}
- {fileID: 2844759635811244993}
m_Father: {fileID: 2844759637480249415}
m_RootOrder: 0
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2844759636631124796
MonoBehaviour:
Expand Down Expand Up @@ -754,7 +754,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2844759637480249415}
m_RootOrder: 1
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2844759636876101696
MonoBehaviour:
Expand Down Expand Up @@ -919,6 +919,8 @@ Transform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 7434618925055714561}
- {fileID: 4263160497459758845}
- {fileID: 2844759636631124739}
- {fileID: 2844759636876101700}
m_Father: {fileID: 0}
Expand Down Expand Up @@ -1031,6 +1033,87 @@ Animator:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!1 &4943446557949318664
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4263160497459758845}
- component: {fileID: 3010867476013172579}
- component: {fileID: 1172881653651875030}
- component: {fileID: 2644557470996910844}
m_Layer: 0
m_Name: On BENCHMARK_TAKESCREENSHOT
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4263160497459758845
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4943446557949318664}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2844759637480249415}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &3010867476013172579
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4943446557949318664}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4a42a87995c7dd1418e01c581ec175f1, type: 3}
m_Name:
m_EditorClassIdentifier:
MessageName: REF_SHOT
OnMessageRecieved:
- {fileID: 1172881653651875030}
--- !u!114 &1172881653651875030
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4943446557949318664}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ebc2b0ba75ae08f46b7de01892c0fdf9, type: 3}
m_Name:
m_EditorClassIdentifier:
Name: if --benchmark
Option: --benchmark
OnArgumentPresent:
- {fileID: 2644557470996910844}
OnArgumentAbsent: []
--- !u!114 &2644557470996910844
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4943446557949318664}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 243cd724bfb1cdd45986699812abcbe1, type: 3}
m_Name:
m_EditorClassIdentifier:
Name: Take Screenshot
supersampleRate: 1
fileName: ../Spaceship-REF
figureCount: 3
--- !u!1 &5005771225792427721
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1099,6 +1182,84 @@ Animator:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
m_KeepAnimatorControllerStateOnDisable: 0
--- !u!1 &5609648839956752477
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7434618925055714561}
- component: {fileID: 9119108623488123060}
- component: {fileID: 6247321215698336170}
- component: {fileID: 6832814332853416876}
m_Layer: 0
m_Name: 'OnStart : if --benchmark'
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7434618925055714561
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5609648839956752477}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2844759637480249415}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &9119108623488123060
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5609648839956752477}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 718c1945292acbd4497cd28bcaa94f8d, type: 3}
m_Name:
m_EditorClassIdentifier:
OnStart:
- {fileID: 6247321215698336170}
--- !u!114 &6247321215698336170
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5609648839956752477}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ebc2b0ba75ae08f46b7de01892c0fdf9, type: 3}
m_Name:
m_EditorClassIdentifier:
Name: if --benchmark
Option: --benchmark
OnArgumentPresent:
- {fileID: 6832814332853416876}
OnArgumentAbsent: []
--- !u!114 &6832814332853416876
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5609648839956752477}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fb7550328a1a2854dbb17d655187a381, type: 3}
m_Name:
m_EditorClassIdentifier:
Name: Enable FPS Manager
Toggle: 1
--- !u!1 &6517450252798828125
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1341,18 +1502,18 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9f634f86068ede4438eadd4e55c7c49a, type: 3}
--- !u!95 &1084765432219353402 stripped
Animator:
m_CorrespondingSourceObject: {fileID: 2915871545750405836, guid: 9f634f86068ede4438eadd4e55c7c49a,
type: 3}
m_PrefabInstance: {fileID: 2844759635663094774}
m_PrefabAsset: {fileID: 0}
--- !u!4 &1031820456864437346 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2966569147669108628, guid: 9f634f86068ede4438eadd4e55c7c49a,
type: 3}
m_PrefabInstance: {fileID: 2844759635663094774}
m_PrefabAsset: {fileID: 0}
--- !u!95 &1084765432219353402 stripped
Animator:
m_CorrespondingSourceObject: {fileID: 2915871545750405836, guid: 9f634f86068ede4438eadd4e55c7c49a,
type: 3}
m_PrefabInstance: {fileID: 2844759635663094774}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &2974126913820124107
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1422,15 +1583,15 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9f634f86068ede4438eadd4e55c7c49a, type: 3}
--- !u!95 &85982992156205319 stripped
Animator:
m_CorrespondingSourceObject: {fileID: 2915871545750405836, guid: 9f634f86068ede4438eadd4e55c7c49a,
type: 3}
m_PrefabInstance: {fileID: 2974126913820124107}
m_PrefabAsset: {fileID: 0}
--- !u!4 &30793230800794719 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2966569147669108628, guid: 9f634f86068ede4438eadd4e55c7c49a,
type: 3}
m_PrefabInstance: {fileID: 2974126913820124107}
m_PrefabAsset: {fileID: 0}
--- !u!95 &85982992156205319 stripped
Animator:
m_CorrespondingSourceObject: {fileID: 2915871545750405836, guid: 9f634f86068ede4438eadd4e55c7c49a,
type: 3}
m_PrefabInstance: {fileID: 2974126913820124107}
m_PrefabAsset: {fileID: 0}
31 changes: 31 additions & 0 deletions Assets/Scripts/Debug/FPSManagerToggleAction.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using GameplayIngredients;
using GameplayIngredients.Actions;
using UnityEngine;

public class FPSManagerToggleAction : ActionBase
{
public ToggleGameObjectAction.GameObjectToggle.GameObjectToggleState Toggle;

public override void Execute(GameObject instigator = null)
{
if(Manager.Has<FPSManager>())
{
var manager = Manager.Get<FPSManager>();

switch (Toggle)
{
case ToggleGameObjectAction.GameObjectToggle.GameObjectToggleState.Disable:
manager.FPSRoot.SetActive(false);
break;
case ToggleGameObjectAction.GameObjectToggle.GameObjectToggleState.Enable:
manager.FPSRoot.SetActive(true);
break;
case ToggleGameObjectAction.GameObjectToggle.GameObjectToggleState.Toggle:
manager.FPSRoot.SetActive(!manager.FPSRoot.activeInHierarchy);
break;
default:
break;
}
}
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/Debug/FPSManagerToggleAction.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ string preferenceName
public string BuildPath;
public string ExecutableName;
public bool CleanupBeforeBuild = true;
public string RunWithArguments;

public BuildProfile Profile;
public SceneList SceneList;
Expand Down Expand Up @@ -98,6 +99,7 @@ public void RunBuild()
ProcessStartInfo info = new ProcessStartInfo();
string path = Application.dataPath + "/../" + BuildPath;
info.FileName = path + ExecutableName;
info.Arguments = RunWithArguments;
info.WorkingDirectory = path;
info.UseShellExecute = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ namespace GameplayIngredients.Actions
{
public class TakeScreenshotAction : ActionBase
{
[Tooltip("Super Sampling multiplier")]
public int supersampleRate = 1;
[Tooltip("Base Filename (will be numbered) ")]
public string fileName = "screenshot";
[Tooltip("How many digits in the sequence numbers.")]
public int figureCount = 2;
private int screenshotNumber = 0;

public override void Execute(GameObject instigator = null)
{
ScreenCapture.CaptureScreenshot(name + screenshotNumber.ToString().PadLeft(figureCount, '0') + ".png", supersampleRate);
ScreenCapture.CaptureScreenshot(fileName + screenshotNumber.ToString().PadLeft(figureCount, '0') + ".png", supersampleRate);
screenshotNumber += 1;
}
}
Expand Down

0 comments on commit e5d2c5f

Please sign in to comment.