added scene switcher debug menu

can be accessed at any time with the
This commit is contained in:
slevy14 2023-04-26 13:03:48 -07:00
parent 6612092d51
commit 41d128373d
10 changed files with 1760 additions and 14 deletions

View File

@ -154,6 +154,15 @@
"processors": "",
"interactions": "",
"initialStateCheck": false
},
{
"name": "ToggleDebugMenu",
"type": "Button",
"id": "78900e90-595e-493a-b089-37295389cb80",
"expectedControlType": "Button",
"processors": "",
"interactions": "",
"initialStateCheck": false
}
],
"bindings": [
@ -178,6 +187,17 @@
"action": "AdvanceDialog",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "2044f2bd-2b93-4c90-a43f-a68f845ba04c",
"path": "<Keyboard>/backquote",
"interactions": "",
"processors": "",
"groups": "",
"action": "ToggleDebugMenu",
"isComposite": false,
"isPartOfComposite": false
}
]
}

File diff suppressed because it is too large Load Diff

View File

@ -266,15 +266,15 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_Sprite: {fileID: 21300000, guid: 3f137cb9700c7413c9b01b8511ede548, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4

View File

@ -0,0 +1,38 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using TMPro;
public class DebugSceneSwitcher : MonoBehaviour
{
void Awake() {
// check to see if a debug canvas already exists
if (GameObject.FindGameObjectWithTag("DebugCanvas") != null) {
Destroy(this.gameObject);
} else { // if it doesn't, then this is the only one
this.gameObject.tag = "DebugCanvas";
}
DontDestroyOnLoad(this.gameObject);
CreateDropdownOptions();
}
void CreateDropdownOptions() {
TMP_Dropdown sceneDropdown = GameObject.Find("SceneSwitcherDropdown").GetComponent<TMP_Dropdown>();
if (sceneDropdown.options.Count == 0) {
List<string> sceneNames = new List<string>();
for (int i = 0; i < SceneManager.sceneCountInBuildSettings; i++) {
string newName = System.IO.Path.GetFileNameWithoutExtension(SceneUtility.GetScenePathByBuildIndex(i));
print(newName);
sceneNames.Add(newName);
}
sceneDropdown.AddOptions(sceneNames);
}
}
public void ChangeScene(int index) {
// print(index);
GameObject.FindGameObjectWithTag("SceneManager").GetComponent<SceneController>().LoadChosenScene(index);
}
}

View File

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

View File

@ -38,4 +38,8 @@ public class SceneController : MonoBehaviour
SceneManager.LoadScene(0); // main menu scene should be 0
}
public void LoadChosenScene(int index) {
SceneManager.LoadScene(index);
}
}

View File

@ -15,6 +15,8 @@ public class StateController : MonoBehaviour {
public bool isPaused = false;
public GameObject pauseMenuCanvas;
GameObject debugCanvas;
void Awake() {
// check to see if a state controller already exists
if (GameObject.FindGameObjectWithTag("StateController") != null) {
@ -24,6 +26,9 @@ public class StateController : MonoBehaviour {
}
DontDestroyOnLoad(this.gameObject);
SceneManager.sceneLoaded += OnSceneLoaded;
debugCanvas = GameObject.Find("DebugCanvas");
debugCanvas.SetActive(false);
}
void OnSceneLoaded(Scene scene, LoadSceneMode mode) {
@ -44,10 +49,14 @@ public class StateController : MonoBehaviour {
if (isPaused) {
Unpause();
}
}
void OnToggleDebugMenu() {
debugCanvas.SetActive(!debugCanvas.activeSelf);
}
void OnPause() {
if (pauseMenuCanvas != null) {
if (!isPaused) {
Time.timeScale = 0;
TogglePauseMenu(true);
@ -57,6 +66,7 @@ public class StateController : MonoBehaviour {
}
isPaused = !isPaused;
}
}
public void Unpause() {
Time.timeScale = 1;

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View File

@ -0,0 +1,124 @@
fileFormatVersion: 2
guid: 3f137cb9700c7413c9b01b8511ede548
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 32
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -15,6 +15,7 @@ TagManager:
- spawnPoint
- StateController
- SceneManager
- DebugCanvas
layers:
- Default
- TransparentFX