Show / Hide Table of Contents

Class DebugActionFlag

Flag action will be represented as a button selector in the debug menu, triggering the action will cycle the value and notify the flag listener, if isPersistence is true, the value will also be updated to PlayerPrefs.

Inheritance
System.Object
BaseDebugAction
FluentAction<DebugActionFlag>
DebugActionFlag
Inherited Members [+/-]
. . .
FluentAction<DebugActionFlag>.WithId(String)
FluentAction<DebugActionFlag>.WithAction(Action)
FluentAction<DebugActionFlag>.WithName(String)
FluentAction<DebugActionFlag>.WithDescription(String)
FluentAction<DebugActionFlag>.WithGroup(String)
FluentAction<DebugActionFlag>.WithShortcutKey(String)
FluentAction<DebugActionFlag>.WithActionColor(Color)
FluentAction<DebugActionFlag>.WithClosePanelAfterTrigger(Boolean)
BaseDebugAction.group
BaseDebugAction.name
BaseDebugAction.id
BaseDebugAction.description
BaseDebugAction.shortcutKey
BaseDebugAction.closePanelAfterTrigger
BaseDebugAction.actionColor
BaseDebugAction.unityAction
BaseDebugAction.action
BaseDebugAction.actionStatus
BaseDebugAction.ResolveAction()
BaseDebugAction.CanDisplayAction()
Namespace: BennyKok.RuntimeDebug.Actions
Assembly: com.bennykok.runtime-debug-action.dll
Syntax
[Serializable]
public class DebugActionFlag : FluentAction<DebugActionFlag>
Examples
RuntimeDebugSystem.RegisterActions(
    DebugActionBuilder.Flag()
        .WithName("Target FPS")
        .WithFlag("target-fps", new string[] { "Default", "30", "60" }, true)
        .WithFlagListener((flag) =>
        {
            switch (flag)
            {
                case 0:
                    Application.targetFrameRate = -1;
                    break;
                case 1:
                    Application.targetFrameRate = 30;
                    break;
                case 2:
                    Application.targetFrameRate = 60;
                    break;
            }
        })
);
RuntimeDebugSystem.RegisterActions(
    DebugActionBuilder.Flag()
        .WithName("Set Screen Orientation")
        .WithFlag("screen-orientation", Enum.GetNames(typeof(ScreenOrientation)), true, (int)Screen.orientation)
        .WithFlagListener((flag) =>
        {
            Screen.orientation = (ScreenOrientation)(int)flag;
        })
);

Fields

BOOLEAN_VALUES

Declaration
public static readonly string[] BOOLEAN_VALUES
Field Value
Type Description
System.String[]

defaultFlagValue

Declaration
[NonSerialized]
public int defaultFlagValue
Field Value
Type Description
System.Int32

flagKey

Declaration
public string flagKey
Field Value
Type Description
System.String

flagValue

Declaration
public int flagValue
Field Value
Type Description
System.Int32

flagValues

Declaration
public string[] flagValues
Field Value
Type Description
System.String[]

isPersistence

If true, the key will be saved to PlayerPrefs

Declaration
[Title("Flag", 2)]
public bool isPersistence
Field Value
Type Description
System.Boolean

onFlagChange

Declaration
public Action<DebugActionFlag> onFlagChange
Field Value
Type Description
System.Action<DebugActionFlag>

Methods

CycleFlagValue(Boolean)

Declaration
public bool CycleFlagValue(bool invokeFlagListener = true)
Parameters
Type Name Description
System.Boolean invokeFlagListener
Returns
Type Description
System.Boolean

GetDescription()

Declaration
public override string GetDescription()
Returns
Type Description
System.String
Overrides
BaseDebugAction.GetDescription()

GetFlagKeyWithPrefix(String)

Declaration
public static string GetFlagKeyWithPrefix(string key)
Parameters
Type Name Description
System.String key
Returns
Type Description
System.String

InvokeFlagListener()

Declaration
public void InvokeFlagListener()

OnBeforeSerialize()

Declaration
public void OnBeforeSerialize()

ResetFlag(Boolean)

Declaration
public bool ResetFlag(bool invokeFlagListener = true)
Parameters
Type Name Description
System.Boolean invokeFlagListener
Returns
Type Description
System.Boolean

SetFlagValue(Int32, Boolean)

Declaration
public bool SetFlagValue(int newFlagValue, bool invokeFlagListener = true)
Parameters
Type Name Description
System.Int32 newFlagValue
System.Boolean invokeFlagListener
Returns
Type Description
System.Boolean

Setup()

Declaration
public override void Setup()
Overrides
BaseDebugAction.Setup()

WithFlag(String, Boolean, Boolean)

Declaration
public DebugActionFlag WithFlag(string flagKey, bool persistence = true, bool defaultValue = false)
Parameters
Type Name Description
System.String flagKey
System.Boolean persistence
System.Boolean defaultValue
Returns
Type Description
DebugActionFlag

WithFlag(String, String[], Boolean, Int32)

Declaration
public DebugActionFlag WithFlag(string flagKey, string[] values, bool persistence = true, int defaultValue = 0)
Parameters
Type Name Description
System.String flagKey
System.String[] values
System.Boolean persistence
System.Int32 defaultValue
Returns
Type Description
DebugActionFlag

WithFlagListener(Action<DebugActionFlag>, Boolean)

Declaration
public DebugActionFlag WithFlagListener(Action<DebugActionFlag> onFlagChange, bool invokeNowIfDirty = true)
Parameters
Type Name Description
System.Action<DebugActionFlag> onFlagChange
System.Boolean invokeNowIfDirty
Returns
Type Description
DebugActionFlag

Operators

Implicit(DebugActionFlag to Boolean)

Declaration
public static implicit operator bool (DebugActionFlag flag)
Parameters
Type Name Description
DebugActionFlag flag
Returns
Type Description
System.Boolean

Implicit(DebugActionFlag to Int32)

Declaration
public static implicit operator int (DebugActionFlag flag)
Parameters
Type Name Description
DebugActionFlag flag
Returns
Type Description
System.Int32
In This Article
👆 RuntimeDebugAction by ❤️ BennyKok