Class RuntimeDebugSystem
The singleton system class to handle the lifecycle of all runtime debug actions, loading of the settings ScriptableObject and also the communication between the system and UIHandler
Inheritance
Inherited Members [+/-]
Namespace: BennyKok.RuntimeDebug.Systems
Assembly: com.bennykok.runtime-debug-action.dll
Syntax
[AddComponentMenu("Runtime Debug Action/System/Runtime Debug System")]
public class RuntimeDebugSystem : Singleton<RuntimeDebugSystem>
Fields
allActions
Declaration
[NonSerialized]
public List<BaseDebugAction> allActions
Field Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<BaseDebugAction> |
allFlags
Declaration
[NonSerialized]
public List<DebugActionFlag> allFlags
Field Value
| Type | Description |
|---|---|
| System.Collections.Generic.List<DebugActionFlag> |
isInputLayerReady
Declaration
public static bool isInputLayerReady
Field Value
| Type | Description |
|---|---|
| System.Boolean |
PREF_KEY_THEME
Declaration
public const string PREF_KEY_THEME = "rda-pref-theme"
Field Value
| Type | Description |
|---|---|
| System.String |
runtimeDebugUI
Declaration
[Comment("Optional, if the UI not found, will be creating from the theme prefabs in the systems")]
public DebugUIHandler runtimeDebugUI
Field Value
| Type | Description |
|---|---|
| DebugUIHandler |
settings
Declaration
[NonSerialized]
public Settings settings
Field Value
| Type | Description |
|---|---|
| Settings |
Properties
InputLayer
Declaration
public static InputLayer InputLayer { get; }
Property Value
| Type | Description |
|---|---|
| InputLayer |
IsIsSystemEnabled
Declaration
public static bool IsIsSystemEnabled { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsVisible
Declaration
public static bool IsVisible { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Settings
Declaration
public static Settings Settings { get; }
Property Value
| Type | Description |
|---|---|
| Settings |
UIHandler
Declaration
public static DebugUIHandler UIHandler { get; }
Property Value
| Type | Description |
|---|---|
| DebugUIHandler |
Methods
Awake()
Declaration
protected override void Awake()
Overrides
Disable()
To disable the system in runtime
Declaration
public void Disable()
Enable()
To enable back the system in runtime
Declaration
public void Enable()
GetFlag(String)
Check if there's any flags turned on
Declaration
public static DebugActionFlag GetFlag(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | key | The key of the flag |
Returns
| Type | Description |
|---|---|
| DebugActionFlag | If the flag is on |
GetPersistantFlagValue(String, Int32)
Get any persistant flag's value
Declaration
public static int GetPersistantFlagValue(string key, int defaultValue = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | key | Flag key |
| System.Int32 | defaultValue |
Returns
| Type | Description |
|---|---|
| System.Int32 | The flag's value stored in PlayerPrefs |
Hide()
To hide the debug menu
Declaration
public void Hide()
Init()
Auto inject the RuntimeDebugSystem into your scene as a singleton
Declaration
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
public static void Init()
RegisterActions(BaseDebugAction[])
Register any actions to the system
Declaration
public static void RegisterActions(params BaseDebugAction[] actions)
Parameters
| Type | Name | Description |
|---|---|---|
| BaseDebugAction[] | actions | The actions to register |
RegisterActions(String, BaseDebugAction[])
Register any actions to the system with a specific path
Declaration
public static void RegisterActions(string group, params BaseDebugAction[] actions)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | group | The group to set for each actions |
| BaseDebugAction[] | actions | The actions to register |
RegisterActionsAuto(Object, String)
Register actions automatically with reflection looking through method,field,prop with DebugActionAttribute
Declaration
public static BaseDebugAction[] RegisterActionsAuto(object target, string group = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | target | The target to look at |
| System.String | group | Optional group name, if null, will be using the target type's name |
Returns
| Type | Description |
|---|---|
| BaseDebugAction[] | The array of the actions created, use this as a reference for action unregistering |
RegisterActionsAuto(Component, String)
Register actions automatically with reflection looking through method,field,prop with DebugActionAttribute
Declaration
public static BaseDebugAction[] RegisterActionsAuto(Component component, string group = null)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityEngine.Component | component | The component to look at |
| System.String | group | Optional group name, if null, will be using the GameObject's name |
Returns
| Type | Description |
|---|---|
| BaseDebugAction[] | The array of the actions created, use this as a reference for action unregistering |
ReleaseInputBlock()
Declaration
public void ReleaseInputBlock()
RequsetInputBlock()
Declaration
public void RequsetInputBlock()
SendShortcutAction(String)
Declaration
public void SendShortcutAction(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | key |
SetCustomInputLayer(InputLayer)
Set a custom input layer which handles the core part of the keyboard input of the debug system
Declaration
public static void SetCustomInputLayer(InputLayer inputLayer)
Parameters
| Type | Name | Description |
|---|---|---|
| InputLayer | inputLayer | Your custom input layer |
SetTheme(Theme, Boolean)
Change the theme of the current debug menu
Declaration
public static void SetTheme(Theme theme, bool dirty = true)
Parameters
| Type | Name | Description |
|---|---|---|
| Theme | theme | The theme to change to |
| System.Boolean | dirty | If dirty, all the action will be re-initialized |
Show()
To show the debug menu
Declaration
public void Show()
UnregisterActions(BaseDebugAction[])
Unregister specific actions from the system and menu
Declaration
public static void UnregisterActions(params BaseDebugAction[] actions)
Parameters
| Type | Name | Description |
|---|---|---|
| BaseDebugAction[] | actions | The actions to remove |
UnregisterActionsByGroup(String)
Unregister any actions that is in the path
Declaration
public static void UnregisterActionsByGroup(string group)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | group | The path to unregister the actions |
UnregisterActionsById(String)
Unregister any actions that has the same id
Declaration
public static void UnregisterActionsById(string id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | id | The id of the actions to unregister |
Events
OnDebugMenuToggleEvent
Declaration
public event Action<bool> OnDebugMenuToggleEvent
Event Type
| Type | Description |
|---|---|
| System.Action<System.Boolean> |