浏览代码

Pingable Editors for most Ingredients (Event/Logic/Actions/State Machines) (#42)

* Renamed Folder

* Base Factorization for Editors

* BreadcrumbBar Base Work

* Improved UI

* Added Ping Upon Selection (Still lacking pingable editors for StateMachine and State)

* Sorting Files

* Added State/StateMachine Inspectors

* Work on GetDefaultName

* More Action GetDefaultNames

* Logic GetDefaultNames

* Side Panel in IngredientEditor

* Panel Scrolling

* Better Handling of Ingredients Explorer Inspector
/main
GitHub 4 年前
当前提交
19f5b2e6
共有 77 个文件被更改,包括 1145 次插入28 次删除
  1. 8
      CHANGELOG.md
  2. 3
      Editor/CustomInspectors/PingableEditor.cs
  3. 104
      Editor/IngredientsExplorer/IngredientsExplorerWindow.cs
  4. 1
      Editor/PropertyDrawers/CallablePropertyDrawer.cs
  5. 4
      Runtime/LevelScripting/Actions/ApplicationExitAction.cs
  6. 5
      Runtime/LevelScripting/Actions/AttachToObjectAction.cs
  7. 7
      Runtime/LevelScripting/Actions/AudioMixParameterAction.cs
  8. 8
      Runtime/LevelScripting/Actions/AudioMixParameterCurveAction.cs
  9. 7
      Runtime/LevelScripting/Actions/AudioMixSnapshotAction.cs
  10. 9
      Runtime/LevelScripting/Actions/AudioPlayClipAction.cs
  11. 4
      Runtime/LevelScripting/Actions/CursorAction.cs
  12. 2
      Runtime/LevelScripting/Actions/CycleResolutionsAction.cs
  13. 2
      Runtime/LevelScripting/Actions/CycleWindowModeAction.cs
  14. 4
      Runtime/LevelScripting/Actions/DestroyObjectAction.cs
  15. 5
      Runtime/LevelScripting/Actions/DirectorControlRigAction.cs
  16. 4
      Runtime/LevelScripting/Actions/FocusUIAction.cs
  17. 6
      Runtime/LevelScripting/Actions/FullScreenFadeAction.cs
  18. 19
      Runtime/LevelScripting/Actions/GameLevelLoadAction.cs
  19. 5
      Runtime/LevelScripting/Actions/GameManagerSendStartupMessageAction.cs
  20. 5
      Runtime/LevelScripting/Actions/GameSaveLoadSaveAction.cs
  21. 13
      Runtime/LevelScripting/Actions/GameSaveSetValueAction.cs
  22. 5
      Runtime/LevelScripting/Actions/LogAction.cs
  23. 5
      Runtime/LevelScripting/Actions/RandomToggleGameObjectAction.cs
  24. 5
      Runtime/LevelScripting/Actions/ReachPositionRigSetTargetAction.cs
  25. 5
      Runtime/LevelScripting/Actions/RigidbodyAction.cs
  26. 5
      Runtime/LevelScripting/Actions/SendMessageAction.cs
  27. 24
      Runtime/LevelScripting/Actions/SetAnimatorParameterAction.cs
  28. 5
      Runtime/LevelScripting/Actions/SetRandomSeedAction.cs
  29. 5
      Runtime/LevelScripting/Actions/SetTimeScaleAction.cs
  30. 10
      Runtime/LevelScripting/Actions/SpawnPrefabAction.cs
  31. 5
      Runtime/LevelScripting/Actions/StreamingLevelAction.cs
  32. 2
      Runtime/LevelScripting/Actions/SwitcherAction.cs
  33. 5
      Runtime/LevelScripting/Actions/TakeScreenshotAction.cs
  34. 5
      Runtime/LevelScripting/Actions/TeleportGameObjectAction.cs
  35. 5
      Runtime/LevelScripting/Actions/TimelineControlAction.cs
  36. 5
      Runtime/LevelScripting/Actions/ToggleBehaviourAction.cs
  37. 5
      Runtime/LevelScripting/Actions/ToggleGameObjectAction.cs
  38. 5
      Runtime/LevelScripting/Actions/ToggleUIAction.cs
  39. 5
      Runtime/LevelScripting/Actions/UnityEventAction.cs
  40. 5
      Runtime/LevelScripting/Actions/VFXSendEventAction.cs
  41. 4
      Runtime/LevelScripting/Actions/VFXSetPropertyAction.cs
  42. 1
      Runtime/LevelScripting/Callable.cs
  43. 2
      Runtime/LevelScripting/Events/OnAwakeEvent.cs
  44. 7
      Runtime/LevelScripting/Logic/DelayedLogic.cs
  45. 5
      Runtime/LevelScripting/Logic/FlipFlopLogic.cs
  46. 5
      Runtime/LevelScripting/Logic/NTimesLogic.cs
  47. 5
      Runtime/LevelScripting/Logic/NextFrameLogic.cs
  48. 5
      Runtime/LevelScripting/Logic/PlatformLogic.cs
  49. 5
      Runtime/LevelScripting/Logic/RandomLogic.cs
  50. 21
      Runtime/LevelScripting/Logic/SaveDataLogic.cs
  51. 5
      Runtime/LevelScripting/Logic/SaveDataSwitchOnIntLogic.cs
  52. 5
      Runtime/LevelScripting/Logic/SetInstigatorFromFactoryLogic.cs
  53. 5
      Runtime/LevelScripting/Logic/SetInstigatorLogic.cs
  54. 12
      Runtime/LevelScripting/Logic/StateLogic.cs
  55. 58
      Documentation~/Images/BreadCrumb.afphoto
  56. 42
      Editor/CustomInspectors/ActionBaseEditor.cs
  57. 11
      Editor/CustomInspectors/ActionBaseEditor.cs.meta
  58. 35
      Editor/CustomInspectors/EventBaseEditor.cs
  59. 11
      Editor/CustomInspectors/EventBaseEditor.cs.meta
  60. 141
      Editor/CustomInspectors/IngredientEditor.cs
  61. 11
      Editor/CustomInspectors/IngredientEditor.cs.meta
  62. 43
      Editor/CustomInspectors/LogicBaseEditor.cs
  63. 11
      Editor/CustomInspectors/LogicBaseEditor.cs.meta
  64. 73
      Editor/CustomInspectors/RigEditor.cs
  65. 35
      Editor/CustomInspectors/StateEditor.cs
  66. 11
      Editor/CustomInspectors/StateEditor.cs.meta
  67. 35
      Editor/CustomInspectors/StateMachineEditor.cs
  68. 11
      Editor/CustomInspectors/StateMachineEditor.cs.meta
  69. 30
      Editor/PropertyDrawers/CallableNamePropertyDrawer.cs
  70. 11
      Editor/PropertyDrawers/CallableNamePropertyDrawer.cs.meta
  71. 42
      Icons/BreadCrumb.png
  72. 108
      Icons/BreadCrumb.png.meta
  73. 7
      Runtime/Attributes/CallableNameAttribute.cs
  74. 11
      Runtime/Attributes/CallableNameAttribute.cs.meta
  75. 8
      Editor/Rigs.meta
  76. 0
      /Editor/CustomInspectors/RigEditor.cs.meta

8
CHANGELOG.md


## 2020.2.4
#### Fixed
#### Added
* CheckWindow: Better search for referenced objects in scene
* Custom Pingable Inspectors for Events, Logic, Actions, State Machines and States.
* Better Automatic Naming for Logic and Actions.
* CheckWindow: Better search for referenced objects in scene
* Obsoleted **SwitcherAction** (left over from the old world)
## 2020.2.3

3
Editor/CustomInspectors/PingableEditor.cs


{
public abstract class PingableEditor : NaughtyInspector
{
public bool needRepaint { get => m_pingValue > 0; }
float m_pingValue;
static MonoBehaviour m_NextToPing;

public override void OnInspectorGUI()
{
Rect r = EditorGUILayout.BeginVertical();
bool needRepaint = UpdatePing(r);
UpdatePing(r);
OnInspectorGUI_PingArea();

104
Editor/IngredientsExplorer/IngredientsExplorerWindow.cs


s_Instance.SelectItem(selected);
}
const int PANEL_WIDTH = 400;
const int MIN_WIDTH = PANEL_WIDTH+60;
const string kPref = "GameplayIngredients.IngredientsExplorer.ShowPanel";
static bool showPanel
{
get => EditorPrefs.GetBool(kPref, false);
set => EditorPrefs.SetBool(kPref, value);
}
public static IngredientsExplorerWindow instance
{
get
{
if (s_Instance == null)
s_Instance = GetWindow<IngredientsExplorerWindow>();
return s_Instance;
}
}
[SerializeField]
static IngredientsExplorerWindow s_Instance;
private void OnDisable()

});
menu.DropDown(buttonRect);
}
if(position.width > MIN_WIDTH)
showPanel = GUILayout.Toggle(showPanel, "...", EditorStyles.toolbarButton);
Rect r = GUILayoutUtility.GetRect(position.width, position.height - tbHeight);
m_TreeView.OnGUI(r);
using(new GUILayout.HorizontalScope())
{
Rect r = GUILayoutUtility.GetRect(position.width - PANEL_WIDTH, position.height - tbHeight);
m_TreeView.OnGUI(r);
if (position.width > MIN_WIDTH && showPanel)
{
PanelGUI();
}
}
}
static void SetEditorFor(MonoBehaviour bh)
{
if (bh == null)
s_Editor = null;
s_Editor = UnityEditor.Editor.CreateEditor(bh);
}
[SerializeField]
static UnityEditor.Editor s_Editor;
[SerializeField]
static Vector2 s_panelScroll;
void PanelGUI()
{
using(new GUILayout.HorizontalScope())
{
Rect r = GUILayoutUtility.GetRect(1, 1, GUILayout.Width(1), GUILayout.ExpandHeight(true));
EditorGUI.DrawRect(r, Color.black);
using(new GUILayout.VerticalScope(GUILayout.Width(PANEL_WIDTH)))
{
s_Editor?.DrawHeader();
using (new GUILayout.HorizontalScope(GUILayout.ExpandHeight(true)))
{
GUILayout.Space(16);
using (new GUILayout.VerticalScope())
{
s_panelScroll = GUILayout.BeginScrollView(s_panelScroll);
GUILayout.Space(4);
s_Editor?.OnInspectorGUI();
GUILayout.EndScrollView();
}
GUILayout.Space(4);
if (s_Editor is PingableEditor)
{
if ((s_Editor as PingableEditor).needRepaint)
{
Repaint();
}
}
}
}
}
}
void SelectItem(MonoBehaviour target)

listRoot.Add(GetNode(item, stack));
}
}
}
CallTreeNode GetNode(MonoBehaviour bhv, Stack<object> stack)

if(m_Bindings[selectedIds[0]].Target != null)
{
var node = m_Bindings[selectedIds[0]];
Selection.activeObject = node.Target;
if (node.Type == CallTreeNodeType.Rig)
RigEditor.PingObject(node.Target as Rig);
if (!(showPanel && instance.position.width > MIN_WIDTH))
{
Selection.activeObject = node.Target;
if (node.Type == CallTreeNodeType.Rig
|| node.Type == CallTreeNodeType.Action
|| node.Type == CallTreeNodeType.Logic
|| node.Type == CallTreeNodeType.Event
|| node.Type == CallTreeNodeType.StateMachine
|| node.Type == CallTreeNodeType.State
)
{
PingableEditor.PingObject(node.Target);
}
}
else
SetEditorFor(node.Target);
}
}

1
Editor/PropertyDrawers/CallablePropertyDrawer.cs


if (GUI.Button(gotoRect, ">"))
{
Selection.activeObject = property.objectReferenceValue;
PingableEditor.PingObject(Selection.activeObject as MonoBehaviour);
}
if (GUI.Button(pickRect, (property.objectReferenceValue as Callable).Name, EditorStyles.popup))

4
Runtime/LevelScripting/Actions/ApplicationExitAction.cs


Application.Quit();
#endif
}
public override string GetDefaultName()
{
return $"Exit Application";
}
}
}

5
Runtime/LevelScripting/Actions/AttachToObjectAction.cs


attachment.transform.parent = null;
}
}
public override string GetDefaultName()
{
return $"{action} : {(AttachInstigator?"instigator":"objects")} to '{parentObject?.name}'";
}
}
}

7
Runtime/LevelScripting/Actions/AudioMixParameterAction.cs


{
public AudioMixer AudioMixer;
public string Parameter;
public string Parameter = "Parameter";
public float Value;
public float InterpDuration = 0;

{
throw new InvalidOperationException("Parameter " + parameter + " does not exist on target AudioMixer : " + mixer.name);
}
}
public override string GetDefaultName()
{
return $"Set Mixer Param:'{Parameter}' to {Value} ({InterpDuration})s";
}
}
}

8
Runtime/LevelScripting/Actions/AudioMixParameterCurveAction.cs


{
public AudioMixer AudioMixer;
public string Parameter;
public AnimationCurve Curve;
public string Parameter = "Parameter";
public AnimationCurve Curve = AnimationCurve.Linear(0,0,1,1);
public float InterpDuration = 2.0f;
public UnityEvent OnInterpComplete;

yield return new WaitForEndOfFrame();
onInterpComplete.Invoke();
}
public override string GetDefaultName()
{
return $"Set Mixer Curve Param:'{Parameter}' ({InterpDuration})s";
}
}

7
Runtime/LevelScripting/Actions/AudioMixSnapshotAction.cs


public override void Execute(GameObject instigator = null)
{
Mixer.TransitionToSnapshots(new AudioMixerSnapshot[]{ Mixer.FindSnapshot(SnapshotName)}, new float[]{ 1.0f}, TimeToReach);
Mixer?.TransitionToSnapshots(new AudioMixerSnapshot[]{ Mixer.FindSnapshot(SnapshotName)}, new float[]{ 1.0f}, TimeToReach);
}
public override string GetDefaultName()
{
return $"Set Mixer Snapshot:'{SnapshotName}' ({TimeToReach})s";
}
}

9
Runtime/LevelScripting/Actions/AudioPlayClipAction.cs


public class AudioPlayClipAction : ActionBase
{
public AudioClip Clip;
[NonNullCheck]
public AudioSource Source;
public bool RandomizePitch = false;
[ShowIf("RandomizePitch")]

Source.Play();
}
}
public override string GetDefaultName()
{
if(Clip == null)
return $"Play Audio Source: '{Source?.name}'";
else
return $"Play Audio clip '{Clip.name}' on '{Source?.name}'";
}
}
}

4
Runtime/LevelScripting/Actions/CursorAction.cs


Cursor.lockState = LockState;
Cursor.visible = CursorVisible;
}
public override string GetDefaultName()
{
return $"{(CursorVisible ? "Show" : "Hide")} Cursor / Lock: {LockState}";
}
}
}

2
Runtime/LevelScripting/Actions/CycleResolutionsAction.cs


using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;

{
[Obsolete]
public class CycleResolutionsAction : ActionBase
{
public Text ButtonLabel;

2
Runtime/LevelScripting/Actions/CycleWindowModeAction.cs


using System;
[Obsolete]
public class CycleWindowModeAction : ActionBase
{
public Text ButtonLabel;

4
Runtime/LevelScripting/Actions/DestroyObjectAction.cs


if(DestroyInstigator && instigator != null)
Destroy(instigator);
}
public override string GetDefaultName()
{
return $"Destroy {(DestroyInstigator?"instigator": "objects")}";
}
}
}

5
Runtime/LevelScripting/Actions/DirectorControlRigAction.cs


directorControlRig.timeline = TimelineAsset;
}
public override string GetDefaultName()
{
return $"Set DirectorControlRig:{(SetPlayMode? " "+PlayMode.ToString():"")}{(SetWrapMode ? " " + WrapMode.ToString() : "")}{(SetTime ? " Time: " + Time.ToString() : "")}{(SetStopTime ? " Stop Time: " + Time.ToString() : "")}{(SetTimeline ? " Timeline: " + TimelineAsset?.name : "")}";
}
}
}

4
Runtime/LevelScripting/Actions/FocusUIAction.cs


UIObjectToFocus.Select();
}
}
public override string GetDefaultName()
{
return $"Focus UI : '{UIObjectToFocus?.name}'";
}
}
}

6
Runtime/LevelScripting/Actions/FullScreenFadeAction.cs


[ReorderableList]
public Callable[] OnComplete;
}
public override string GetDefaultName()
{
return $"Full Screen Fade {Fading} {Duration}s ({fadeTimingMode})";
}
}

19
Runtime/LevelScripting/Actions/GameLevelLoadAction.cs


}
manager.SwitchLevel(index, ShowUI, OnComplete, SaveProgress);
}
public override string GetDefaultName()
{
string label = "";
switch (level)
{
case Target.MainMenu: label = "Main Menu"; break;
case Target.First: label = "First Level"; break;
case Target.Last: label = "Last Level"; break;
case Target.Current: label = "Current Level"; break;
case Target.Previous: label = "Previous Level"; break;
case Target.Next: label = "Next Level"; break;
case Target.SpecifiedLevel:
label = $"{specifiedLevel?.name}";
break;
case Target.FromGameSave: label = "From Game Save"; break;
}
return $"Game Manager Load : {label}";
}
}
}

5
Runtime/LevelScripting/Actions/GameManagerSendStartupMessageAction.cs


break;
}
}
public override string GetDefaultName()
{
return $"Game Manager Send : {messageType}";
}
}
}

5
Runtime/LevelScripting/Actions/GameSaveLoadSaveAction.cs


Manager.Get<GameSaveManager>().SaveUserSave(UserSaveIndex);
}
}
public override string GetDefaultName()
{
return $"{action} Game Save ({saveLocation}{(saveLocation == GameSaveManager.Location.User?UserSaveIndex.ToString():"")})";
}
}
}

13
Runtime/LevelScripting/Actions/GameSaveSetValueAction.cs


}
}
public override string GetDefaultName()
{
string value = "";
switch (valueType)
{
case GameSaveManager.ValueType.Bool: value = BoolValue.ToString(); break;
case GameSaveManager.ValueType.Int: value = IntValue.ToString(); break;
case GameSaveManager.ValueType.Float: value = FloatValue.ToString(); break;
case GameSaveManager.ValueType.String: value = StringValue.ToString(); break;
}
return $"Game Save Set {valueType} '{Key}' = {value}";
}
bool isString() { return valueType == GameSaveManager.ValueType.String; }
bool isBool() { return valueType == GameSaveManager.ValueType.Bool; }
bool isInt() { return valueType == GameSaveManager.ValueType.Int; }

5
Runtime/LevelScripting/Actions/LogAction.cs


return text;
}
public override string GetDefaultName()
{
return $"Log {type} : '{LogText}'";
}
}
}

5
Runtime/LevelScripting/Actions/RandomToggleGameObjectAction.cs


Targets[i] = transform.GetChild(i).gameObject;
}
}
public override string GetDefaultName()
{
return $"Toggle Random Object from List";
}
}
}

5
Runtime/LevelScripting/Actions/ReachPositionRigSetTargetAction.cs


Debug.LogWarning($"{gameObject.name}: ReachPositionRigSetTarget action could not set target : Target is null");
}
}
public override string GetDefaultName()
{
return $"ReachPositionRig Set Target : '{(UseInstigatorAsTarget?"instigator": target?.name)}'";
}
}
}

5
Runtime/LevelScripting/Actions/RigidbodyAction.cs


force = (actionType == RigidbodyActionType.Force || actionType == RigidbodyActionType.Torque);
explosion = (actionType == RigidbodyActionType.ExplosionForce);
}
public override string GetDefaultName()
{
return $"RigidBody {actionType} on {(ApplyOnInstigator?"instigator":m_Rigidbody?.gameObject.name)}";
}
}
}

5
Runtime/LevelScripting/Actions/SendMessageAction.cs


{
Messager.Send(MessageToSend, instigator);
}
public override string GetDefaultName()
{
return $"Send Message : '{MessageToSend}'";
}
}
}

24
Runtime/LevelScripting/Actions/SetAnimatorParameterAction.cs


showFloat = (parameterType == AnimatorParameterType.Float);
showInt = (parameterType == AnimatorParameterType.Int);
}
public override string GetDefaultName()
{
string value = "";
switch (parameterType)
{
case AnimatorParameterType.Bool:
value = boolValue.ToString();
break;
case AnimatorParameterType.Float:
value = floatValue.ToString();
break;
case AnimatorParameterType.Int:
value = intValue.ToString();
break;
case AnimatorParameterType.Trigger:
value = "Trigger";
break;
default:
break;
}
return $"Set Animator '{parameterName}' {parameterType} Parameter = '{value}' ({animator?.gameObject.name})";
}
}
}

5
Runtime/LevelScripting/Actions/SetRandomSeedAction.cs


randomManager.SetRandomSeed(newSeed);
}
}
public override string GetDefaultName()
{
return $"Set Random Seed :'{(newRandomSeed ? "New Seed at Random":newSeed.ToString())}'";
}
}
}

5
Runtime/LevelScripting/Actions/SetTimeScaleAction.cs


TimeScale = value;
Execute();
}
public override string GetDefaultName()
{
return $"Set Time Scale : {TimeScale}";
}
}
}

10
Runtime/LevelScripting/Actions/SpawnPrefabAction.cs


DontDestroyOnLoad(obj);
}
}
public override string GetDefaultName()
{
if (Prefabs == null || Prefabs.Length == 0)
return $"Spawn No Prefabs";
else if (Prefabs.Length == 1)
return $"Spawn Prefab : {Prefabs[0].name}";
else
return $"Spawn {Prefabs.Length} Prefabs";
}
}
}

5
Runtime/LevelScripting/Actions/StreamingLevelAction.cs


sceneNames.Add(scene);
Manager.Get<LevelStreamingManager>().LoadScenes(Action, sceneNames.ToArray(), SceneToActivate, ShowUI, OnLoadComplete);
}
public override string GetDefaultName()
{
return $"Streaming : {Action} {Scenes.Length} scene(s)";
}
}
}

2
Runtime/LevelScripting/Actions/SwitcherAction.cs


using System;
[Obsolete]
public class SwitcherAction : MonoBehaviour
{
public GameObject[] Objects;

5
Runtime/LevelScripting/Actions/TakeScreenshotAction.cs


ScreenCapture.CaptureScreenshot(fileName + screenshotNumber.ToString().PadLeft(figureCount, '0') + ".png", supersampleRate);
screenshotNumber += 1;
}
public override string GetDefaultName()
{
return $"Take Screenshot : {screenshotNumber.ToString().PadLeft(figureCount, '#')}.png";
}
}
}

5
Runtime/LevelScripting/Actions/TeleportGameObjectAction.cs


obj.transform.position = worldPosition;
obj.transform.rotation = rotation;
}
public override string GetDefaultName()
{
return $"Teleport {(TeleportInstigator?"instigator":"objects")} to {(TeleportTarget ? TeleportTarget.name : "(null)")}";
}
}
}

5
Runtime/LevelScripting/Actions/TimelineControlAction.cs


case TimelineControlMode.Hold: director.extrapolationMode = DirectorWrapMode.Hold; break;
}
}
public override string GetDefaultName()
{
return $"Timeline {mode} : '{director?.gameObject.name}'";
}
}
}

5
Runtime/LevelScripting/Actions/ToggleBehaviourAction.cs


}
}
public override string GetDefaultName()
{
return $"Toggle Behaviours";
}
[System.Serializable]
public struct BehaviourToggle
{

5
Runtime/LevelScripting/Actions/ToggleGameObjectAction.cs


}
}
public override string GetDefaultName()
{
return $"Toggle GameObject(s)";
}
[System.Serializable]
public struct GameObjectToggle
{

5
Runtime/LevelScripting/Actions/ToggleUIAction.cs


}
}
public override string GetDefaultName()
{
return $"Toggle UI";
}
[System.Serializable]
public struct UIToggle
{

5
Runtime/LevelScripting/Actions/UnityEventAction.cs


{
OnExecute.Invoke();
}
public override string GetDefaultName()
{
return $"Call UnityEvent(s)";
}
}
}

5
Runtime/LevelScripting/Actions/VFXSendEventAction.cs


var attrib = visualEffect.CreateVFXEventAttribute();
visualEffect.SendEvent(eventName, attrib);
}
public override string GetDefaultName()
{
return $"Send VFX Event '{eventName}' to {visualEffect?.gameObject.name}";
}
}

4
Runtime/LevelScripting/Actions/VFXSetPropertyAction.cs


public override string GetDefaultName()
{
if (!Override)
return $"Reset VFX override for parameter :'{property}' ({dataType})";
return $"Reset VFX override for property :'{property}' ({dataType})";
else
{
switch (dataType)

case DataType.UInt: return $"{visualEffect.name} {property} {UIntValue} ";
case DataType.Int: return $"{visualEffect.name} {property} {IntValue} ";
default:
return $"Set VFX <UNKNOWN> parameter :'{property}'";
return $"Set VFX <UNKNOWN> property :'{property}'";
}
}
}

1
Runtime/LevelScripting/Callable.cs


{
public abstract class Callable : MonoBehaviour, ICallable
{
[CallableName]
public string Name;
public void Reset()

2
Runtime/LevelScripting/Events/OnAwakeEvent.cs


namespace GameplayIngredients.Events
{
public class OnAwakeEvent : MonoBehaviour
public class OnAwakeEvent : EventBase
{
[ReorderableList]
public Callable[] onAwake;

7
Runtime/LevelScripting/Logic/DelayedLogic.cs


m_Coroutine = null;
}
}
public override void Execute(GameObject instigator = null)
{
float newDelay;

m_Coroutine = RunDelay(newDelay, instigator);
StartCoroutine(m_Coroutine);
}
}
public override string GetDefaultName()
{
return $"{delayMode} Delay ({(delayMode == DelayMode.Constant? Delay+"s.":DelayRange.x+"s.~"+DelayRange.y+"s.")})";
}
}
}

5
Runtime/LevelScripting/Logic/FlipFlopLogic.cs


state = State.Flop;
}
}
public override string GetDefaultName()
{
return $"Flip-Flop (Default {state})";
}
}
}

5
Runtime/LevelScripting/Logic/NTimesLogic.cs


Callable.Call(Calls, instigator);
}
}
public override string GetDefaultName()
{
return $"Call only {Count} Times";
}
}
}

5
Runtime/LevelScripting/Logic/NextFrameLogic.cs


Callable.Call(OnNextFrame, instigator);
m_Coroutine = null;
}
public override string GetDefaultName()
{
return $"Call Next Frame";
}
}
}

5
Runtime/LevelScripting/Logic/PlatformLogic.cs


else
Call(OnTestInvalid, instigator);
}
public override string GetDefaultName()
{
return $"If Platform {inclusionMode} : {string.Join(", ",platforms)}";
}
}
}

5
Runtime/LevelScripting/Logic/RandomLogic.cs


int r = Random.Range(0, RandomCalls.Length);
Callable.Call(RandomCalls[r], instigator);
}
public override string GetDefaultName()
{
return $"Call One at Random...";
}
}
}

21
Runtime/LevelScripting/Logic/SaveDataLogic.cs


return false;
}
public override string GetDefaultName()
{
string value = "";
switch (ValueType)
{
default:
case GameSaveManager.ValueType.Bool:
value = BoolTargetValue.ToString();
break;
case GameSaveManager.ValueType.Int:
value = IntTargetValue.ToString();
break;
case GameSaveManager.ValueType.Float:
value = FloatTargetValue.ToString();
break;
case GameSaveManager.ValueType.String:
value = StringTargetValue;
break;
}
return $"Switch on {ValueType} {SaveLocation} Save Data '{Key}' {Test} {value}";
}
void WarnNotExist(string name, GameSaveManager.ValueType type, GameSaveManager.Location location)
{

5
Runtime/LevelScripting/Logic/SaveDataSwitchOnIntLogic.cs


}
}
public override string GetDefaultName()
{
return $"Switch on Integer {SaveLocation} Save Data '{Key}'";
}
void WarnNotExist(string name, GameSaveManager.ValueType type, GameSaveManager.Location location)
{
Debug.LogWarning(string.Format("Save Data Logic: Trying to get {0} value to non existent {1} data in {2} save.", type, name, location));

5
Runtime/LevelScripting/Logic/SetInstigatorFromFactoryLogic.cs


Call(Next, instance);
}
}
public override string GetDefaultName()
{
return $"Set Instigator From Factory: '{Factory?.gameObject.name}' #{FactoryIndex}";
}
}
}

5
Runtime/LevelScripting/Logic/SetInstigatorLogic.cs


{
Call(Next, NewInstigator);
}
public override string GetDefaultName()
{
return $"Set Instigator : '{NewInstigator?.gameObject.name}'";
}
}
}

12
Runtime/LevelScripting/Logic/StateLogic.cs


{
public class StateLogic : LogicBase
{
[NonNullCheck]
[NonNullCheck]
public State TargetState;
[ReorderableList]

public override void Execute(GameObject instigator = null)
{
if (StateMachine.CurrentState == TargetState && IfCurrentState != null && IfCurrentState.Length > 0)
if (StateMachine?.CurrentState == TargetState && IfCurrentState != null && IfCurrentState.Length > 0)
else if (StateMachine.CurrentState != TargetState && IfNotCurrentState != null && IfNotCurrentState.Length > 0)
else if (StateMachine?.CurrentState != TargetState && IfNotCurrentState != null && IfNotCurrentState.Length > 0)
}
public override string GetDefaultName()
{
return $"On State Machine '{StateMachine?.gameObject.name}' state: '{TargetState?.gameObject.name}'";
}
}
}

58
Documentation~/Images/BreadCrumb.afphoto


�KA nsrP#Inf�ZD�VL` Prot#Fil(�/�H5��dYBU@Z�8H��!� {Q�̃ws=cp��F'��$<��J;V2����=lv� ���ѿ�I�\P� �`F ��M�����;t�Q����)0?���n!��TKK]`5�?u��ξ��L�,u�) ją�X�����R����MP�J�"��~)��A���PT
u�WHq��Ru�R(������lz)��?�!�:�g"X����`�j۱�7T�)�˚j��e�v� }d� �c���\���\i��R���4ֺ��e�ڊ\$P��u���@���@��N��?Ċ`�s�~E���/����j*����X.�X�e�~�R��a����\1� D�u 5�� ��kUg�&�o"�&���C]���8��?,ת� �Vt��B�kB�����5���ቊ�%'���`U�u/(����ـ�|�38�͗��p8P����f_'^�տ ��@^�D; �g烂��wJq6?�U�/�e�����4��fP�X�)���U��?���j^�Xa˂z��+��n� �;�:S�C������� ����?ת("6���&%%��'�~<���f�c֤���#����~Lc�&�n&?f�+U<���&%%��GF�߰�ۏ� Y�!�XI�Xǒ��+U<�_쿤l�I&KS"�,�/bj���zd��"8י��M8�ɢ��PW�d�^�s�k�kU��ѡz�^��q�۽Jt�^�sj�� z12]�͉�J7(@����PU�4PB-8�B ��Q��3�4M�E�آe��*E��L3�o��N u!�J+*���t���%�v�U*�4������.�׉��&&1���Š��x��H��F�Z$ϳ���\B@X����8��}:k���V���'�����J��+�� �:Bd k'T��*>4�U��u��$�-ڊV�E��Z"� ��ө����9�`l�����ѥ�<2Uy@��C����~)m�@#�E4dv� D�35ٯ�Z�����ʿ�K�����R�Bg*�W%E��3>3>���qy �<xc%=�����˱z^����j�l�X��}�<�Y�"�05 �U�4� S�D5��F(PM�:S�{J���k^�Dӳ����Y��26<KsK�̮���R# �{13�9ԋ�W�z|C,"mRn��U��8W�^���"<��Gq�˿(���X�!I�g=�n ��W
�-ѡ���ږ<����X�z[��y$���y_��(W2%2�TFǿ���$��
�3yAQe�Ģ^�����
� �~AU���W��?�+K�0�j��C��C�Òsb{��jiHVc���"٩��e�!�����IՕ�d�!Y�� �.$���D+Tݞ�ob����2�!���d�C���$������c���&�?$�*�#LI�"!WI���K�,��8�� J[��h0��?�4�.�p%�I�-�Z=�'T<e��S��d�$sY���mWXM�(M�����q����Cmo�������_et��UZ>T�V�*$��^�����z!���?|i�“�.�����W���$]/���DZM��"Q�#6�'�]d� �$yʨ��Dm�<q��6������k��e�A|������QtU3XK)�Qx�ſRT��� �ibq����J��z��$�N.%v~ݩӑ���2y’���?������#6V&��ARcs��P�$5Hj��h�'�JR����v��D�#�|Y�*lĆ�9�'� �i�� �em�ժ��!�dl$i5IY�$�� ��Q�/�j��p8�����2��V(�|���BU)�q8�͍�f �X�X��Bc|>$�$4h��H\З��2z��ABrrֺc�k�~ꄵBkp8�͍�2����D_4�����.� �3B2V�u��'d�k5�؀��f��q�J�N�Vcs4�����C%��I�GJkٝ�&%XFl�Z�+��f˅l�T��j<a��r�a=O���L޿��L�v��U��U�S���r��BF�{'�㙙)ܽJ��Qe}uP<333333�9�6��WF�J�~���O��Κn�Ed�G~�祪���2o�ڡ��p�\�H�s� U�%�#��Зtcq�Q7��҃7�1������䑥����d���H���_�T)b?������R��_��J���%H0�[��i�_����f?%5#r̙+94��J�� UB� U@��o~!����׉!(/H.�H;��MrY4 ����)FabG/�e
 |�*Y�x��?��؍B���e(0�c�P��e���]��� պ�C��3�y�з��R��I�۹8����^U�g(�K��!(�uj� UbU �\�#��LDGs$�p�A0o�t�CJ�ۙr4�����C_���@Vj���oS�}=R$��H��_�ze��C����d %�U?&K�B������U5�̖R�~=�;���333(2-i�����!��V*� ��?*c翥Ҩ����QKe��!���[Qyq��a�&�_d���𼣰�˽���I�ز)5�b�$;�o����C������ $�ǖ�e�(R����*@sAhH���{��L�g-�A��!��7�b��g�ϋdY�e".x��MK��?^p4_ �����`i�vh&ձ�~S�B�TM�ot�<��[h�׀��z��e��>�~���e�)%����}P4$�8���E�d�M1���� lPL)��"Ư)���IBF L1���4��b0Y��@������t�R@���
���ߓ���!YM �渚���� E��IFc�ͩ�Tf�����*P���{��L1C2k���Q��&��tl�����M�R��������}����q�і��s#t��z\iĹȺW�n�����=Y�*��k���~�2�������m끟��3�O��뉟�a�چa�C M�ת�����̈/��9 �$�3Ѱ3꬜
2��M
9�6V���C 7f�!�:�R�� �uv�W8֔2̱�jđ�!ӥ�c<KXx!eDW��:��X�@�h& Qp�哉X�$t�#� Q�"B*A���h�>�&8��|���s�
&��Ʃ�1l@`��66N���|�aD!2��4�� D��X`��6�����Ā��b�X,( %%%%%%�3�A %%%%%&�-�����PjBLLLL  ��3+G���?�f�����B*���Ye��%�PC�̀3W��R�D�w��t�?����d���r�Y�K�A1���< �R����Ξ*L�F�i�:�������i�^�p������:�۫�XV�]�ڒ̔����\x��b�=mMd��\��P�]X�s���WYz����U�Z���C�p����wa�$�@�l
V��]
;�I�������b�V#���p_�J5���&��t�q�D��%�V/$)a���2��? [�D$��*$�z�WYz<�?|�r� }�z���������U�4ڝ2��㡧�o��90��ʕ敓dj�/-�-+����E�RZC[X
y�D��C@� DB@����=��������y��n@�� 0�,h��k�� ��(�
0��
� /��C ��X�����0-6
`�'X�` ���?88P`@��
���VtK^����$Q�]1W���+�,����0:`��.~����I� �i`�O���ퟁ���m'���� c��������k�p�����̴�"i�]`5$o�s5$��s�\<�;(Ȇ� (4-;Z���B�l��6A�thF!��_�� 1�/��&Ș�G�uG!��o� |�*�|/�~<����z���?��e*��Y���G�[`=�����W����Iv�t�~1����k���>��W`ŰƶwV�?<I.@��(���O,��ݶ�n��mW�����,���N"�Ǖ#Qs�+GڦDا��+mS\��6eQmS�����PYj�F/-m9�si���jvD�ND�Nۮ�\ڊV����y���bŬ�nE�I�$m�ߕTg�O`WR���Cd�':m)���#�<�|VL���(�Q �����;ٌ���嶤�ci(��?�g��R"��?$l� ��KY)�?T�9:i="�zq�l��5��gd_�,7 ����Z�=C�d_�,7����wb�a�QO[
kl�7�T�k�����-��o����R�Z��,��5*���d�bK�����ѕe*���-_�obŖϵm������
���?7���?T����Ry%�Q�0#3��R Ęd���`��F!
�Ac��FB�CT2t�02\T�^�%S�� 1'��s#��r�c]l86 0�;O��ؚ�� �">YC@��9[�-�1pZ���H !| �"���@��!ǐ�������l��_=A�{r�V^��=8��D���Zd�d�f�ȓ�$��enw �����W^a<?J��1��o�OO����I�s|�gɇ��3TKƢ�Ehe��@�Q1�F#* �8s-*��N�o�A�JL~��a;lଣ�� ex���6¢/mÌ�Nlz���,�+���fz�� �5(_�:�_��}e[Y'Q��-@���4�v��6l-��-R��P�ځ<ͫ�f��ɕg1'l���!�� �$YL4I���z�m :m9�n�XR%Ru2�(CmT��@��l����D⭗�+ͭ��2���
�Ͱ�"u�_N����� �B���j�r��"��Թ��]� ���C}&~`!�?��B�v���8Zƚ�ށ�)ۯ�T�"�HYВ�IN�x-��*DD�ؠ�X�
r�b��f�V�g�
�����,A�\c�-�3�UH�G�����H�����p���qWt�I���j���VB��� y����m�4"�)�W䌤ΨG<��M-q3��D^|7��� �~A�ɔ����n�*^b�e�?`��S��3wDg����mSļ�aX�an��o�[8r�)������@�7Y��N�J+9*ް/�8 �^��ޙڛ�V�?m�%IX ;��r�=8�� =����]��;�����6D���ؘ!���)�6���%�$}�H'�% l����s�`jv,��C��Xa�*N'��2'H���Gk�Œ����+jU֥O���GM.Jg��yD�1. �m����uB�}�@:�S��X"Tz^p9Ԃ!�vp8����~�q���Rz?�����h�c2���%����x �8�Ė��%Г�\%h@�9�-��7e�T6G0�ī�� A��0l�(�pA|{�@w�S�,��>?$z�6P�Լe>��*�����<�~d��Ha �����<q�Z�R�@�ʘ-F�b�=lt&ˡ�08�+P�|ճ�l�/v�ia�1��J���1!��� ��.�&n��*X��V{me(��H��ᾝs�b<�{>������h��� �Q�ZG�'����D�D�j���P��3��"r�P�9��@��5�K�\GS����{
�]Ͱ�M�Q����#Fil(�/�HeX�@��A��� 94�|p̀��,�(��ʀ�Pj8
�h@|�&X
 ̀��{
`����#Fil(�/�H������@���a ����N.�����:��9P� � ŀ�p@�����#Fil(�/�H�0���e�!V>
,����#Fil(�/�H}P�. ����g]�7�"R
0!JAM�R� O
6�I4)HL
���"X2,G����A��Dऀ�l�M�RP�`”� �����@���}�b����#Fil(�/�HeP��s� �� �
���2�@ ,
d�2`2�,P̀��L�(�
�̀� �{
`����#Fil(�/�H]@�� �y��� ,*� @�8P0�� `�p@q�����#FT4�VL`ZD[HB�R) 7\b6�doc.dat�U�턅B��n)d/4<=�&��BIx+�d/6�"x���B4$1Wd/7 �xq�"Bazd/8
+UoM��B���d/9 �4>�j B˩��d/a
d/����ThmbWJ�PNG

IHDR���[� pHYs���+�IDATx������:�����{:� x �E��_ž���C�K���x����C ̇*�b�R�_IJ�#�kޣ���z<���몪g��8�+Y��[�_��oI7��Q��K���A�E��RҬ��RRu���C��=��-�?����ޞ�G�f���?�?�:��y��,��w=����g3���f�ɦ���q
�?���?�����g�����O����J$o•��s#�Ͻ���s�(��,%=��QVʪ#I���D�(��5ާ��V'���s9���ņ�CᣬR<����J� pƼx��EG�� ��^�x�O�w.e���l���e��Ң��$t � �W��O���gY`�Wj. D��"���Ub��߿��*K|�࿐U�a$�(V��� ���R��;<�O���C��JywXR��߃�XV(��R��c :��
�����?����J��$K H:�� ��z,����O�~V�Pt �@�s��}?�7�O�3ٓ�@�c ��#�*���ݷ z�؏��'���yJɷnt <�>�΀{Y0�U�� g�]�-�� ��H��P�-;z��ń�������4N����e�?��g�4Rs����H�� + �~V@y��@�k`������?���r
�߻�%>-�����s�4�΄��8��~��DV��G�p6$�}x�-����Y�^�'�c�ّ��A?��]W��C����PF�LH��P�H�O���z��% t <#�!l��-��k�GIʦ��)%�Y9h��1��H�t��n������\)�(���D���"S�� ��M�<A�.�qL��,��"S�/��<q�V�6 v ֟���q@$�c�'�[��U�/[�#�X��b�#S�(���?Jz�_��&;e���F8�8 5��qQ���?���pL���=�������P$GA8&��u���~��Ps���� ���c��x�dG{���,�?��H��R�,�f����M Q tA�x���,�ʒ�U��r�H)�1pG$�.h[8�UV������㉃�=:���e >�W�xu+[0V�c����O%`$�.��|�@ �7���-pX?�؃?�wD8��-�B�=����^d������� @�)���O��'~�p% �+���v�_@������}{��J9�{�`; t���O�s�� ق���?�� �U����j������}3���ǒ�c�/#t�w �f���o��` �&��t�R�Ȓ*^':����-;Δw��ËMW:���\����Q6k��*�-���F v �ɂ���W�8���d� � �Ob���?�{�@�0�����) ��~� �/�u � ���o��������_ �Wb���}J�N�c=��|�����A"�G��=�?�|,�K��? �$���� (O �m~ 5O �M�b�@*����+^��.�>��X�Y�/O|�H}�K��R��w����)%i=yhܿ�fA$���<J�Q�1p"�xPT�6h)�7�6����C�b���4�RyѠw��i�=�3���ޚ�x`. �^� K b��Q}�i���Dxk�v�;��/��+K a\)o\ʪ$�DYh ����~�A���M� �5�� ���?��7����?S���7����&A����������c3�7����
���r��e=�9�߈
��/��6�T�����" ���c �-�����P>>�Q�%p�R���%�#��}�Hx������5Z(�88�m%\�k����c ེP�DA� ����"0�2���^!�W���~6@ �ײi���<nx��� &�Wq
�^�WZ�$8�- (/�P3�� ཊS1���^�������/� �ޫ�۞��;�m����{��^����\�c�������@������q�����kQ�W���<������|��SN��#Ն���l� #���N����eJi&�x��x����R�@�k���l* � �(wlR>���H��O����( �����l�`�r�,���$l�ܫ��?�C�| ��t�]0 ەS1����k����ũ�6$l�R���Q�@�V͝KY��J��C�qj ��2�����<��f_��ʦ:�/���bP�������r�߃���+�,������/��j��Oe }Z�5�ȅ���6��s�ٓ��$��aB)�/8Ǻ��_�_�d � X;o ����O�1���h������������� :�p���V�0�=���C��g���\)8*�m�@|���`�w ��K�*�Q�p>p�����_+�&�"[x���@���$�I8��c��>-p����m$�0b �9����1������ �� �� ��`Q_�)���la�P'�H�a�"@OVƥ֟��ʧR�G�c����'�Y��N�MJ�Z�$���{IJ��=��ӊ��%�!K���`%�� 5;6^����1��ӊ;d;<�'�Çfjv ,�O)���ӊ�b���r��厁嵒%
���$��Wnd/�W��|-K jv ����o~k� �+e���z�����J9��D@��5����,�������?S������]��σ��,���k�?�Oek~�_ ���xD��,�{�@?�;���X�6����T3��dA>^}���(O ��#����_�� �u(K���R�(w
�8ں��M�i��1p&K���c�����Se�@�j.�W��6t $���vA?3`Y���dU��!Y�����$tS�!���iн�ڀA�}_d���u� ��S�c�d��J�*�(��~�}�����5$t�W��|��=�{��]KY��jK���������Fj/�O�ϼ���'NTʧ�����O�e���0��n�V����T�'��,����!��<���e�๚�V��ߊ�n���xPP|=��Y�WI?d;��Sm�(��EI�����N#I�d �w�`���u�H誥��>F�u �I���$�E�z�������x���p�����W|������s�=9�A��*+/�2�wY�������,��@��"��������ԯg��f-�
=��|�W~�V����~�T�2�lyM�)���M������>�����"�V;��,��<���*o�VU5��G�pZ�},Z�g����ϫ� ~6��� ��yg��~"�|W{���6,�� ��s��ʷm e��q�z�l���^��@y�?v��}�T��r����|xW�Qq�=������9��k��=����Y�X�/�$ v���ܓ�#�*�e��S}��~+5;���uo$�V� �L��%k6u�� ��̷]75����!�&$�J�N~��1�O���sY�pt$F�����m+������{�d��H8 Ob��a���,����-~wE�a�m��ex���_W���~|�/+>��������޷�}W>ݯ\O$�g�5^���>�v��=�-�*k���rO�Uq��"���������������|�&?� `�����MV��& �/j��?IiW$l���gZ?�/������ߤ� =����Y�?v���O�~��P������b�{�a��Y8���]��]� �|��;���WNv�߮H�.n����?���o��L�#I�-~_d������)���8+����l�ߤ��|Õ5�H����jv����Mjv���u �=K-�|��󽻟O�u?�������&�{��?�>is�?������]��+_������>�gY����7V����^�����o��~�-��Q����BT����?��7,�_�����
=UV��_9bw����jK|e������}'��T��8{���~��7T��7k�R�G6U���{q{��x�wH�U��x��ϒ����;��A����)�"�E1Xo��a ����ǟ ��Ij/՗�U���Uy�/����s��"�5���i��T��B����l��+�[�_��������v�X �g��y�8�T�8�$�D� ���ƫ�S��@��L6���������$�D[ ���Z�W������#�"@O��;�}�%K�-�mWzb����T ��}���+@����Z�˞�}�߿]�dՀ��qUU�S��.!������'|�.��Fjv�{�;Zݿ+@������1T���]�-~�J��F� �۟˶�yg�Q>������Y� �s�~A�����W�� �����H}���}�ň��`
�IY����e%����~>�5� �/�.�������Y��߼��@$�~i��?�d ��'�)�s�v�i �W��:��(�f��-w�� � V�O櫖����������e���yUU�S��>"t���o Y���f�?���������i�u${����oT>s�;#tA\��]��jv��J����+������`�\��}��o�`
`O$�s�����*{�
���@Y`
��� �� ~�������`
����L���_eI�w�۴S�`G$�.Xi}
&�dI@��ve ��H������=v��S_%}���˩~�{@8&2�=��z���Y�g�������������U��o����H�����V����w��^��O�#Sl�������P������S��?�1��Tyq߫l�_����+$F8������xV���N�pLm �����+w���$GB8�8+���s}�N~eg?�'80�1�����������������/mxo*������+�H�VU��S�`d$�}�d%��ͯ�ul��G�����x�?�><���y��&K�)���?gG�G��7V��W^}�ߦT΄�����a��J������G�LH��������G[�?T:��������8__������STΈ���`�����l��/���~35���{T΄��2(�|�u��]�b�{T΄��r
�+����z�Q�iÕ
��\)gp��ct�_�_������\UO�u%��n$]K��߿;�/������ ~^���Di���d�i1�/%ݞ���Ey�_�������qv�\��������s�(@� d+�}��l�������YE�MF
s��������a��۩���IEND�B`�

42
Editor/CustomInspectors/ActionBaseEditor.cs


using UnityEngine;
using UnityEditor;
using NaughtyAttributes.Editor;
using GameplayIngredients.Actions;
namespace GameplayIngredients.Editor
{
[CustomEditor(typeof(ActionBase), true)]
public class ActionBaseEditor : IngredientEditor
{
SerializedProperty m_Name;
protected override void OnEnable()
{
base.OnEnable();
m_Name = serializedObject.FindProperty("Name");
}
public override void OnInspectorGUI_PingArea()
{
serializedObject.Update();
EditorGUI.BeginChangeCheck();
DrawBreadCrumb("Action", color, () =>
{
NaughtyEditorGUI.PropertyField_Layout(m_Name, true);
OpenIngredientsExplorerButton(serializedObject.targetObject as ActionBase);
});
DrawBaseProperties("Name");
if (EditorGUI.EndChangeCheck())
{
serializedObject.ApplyModifiedProperties();
}
}
static readonly Color color = new Color(1f, .1f, .5f, 1f);
}
}

11
Editor/CustomInspectors/ActionBaseEditor.cs.meta


fileFormatVersion: 2
guid: cb1c7279adfe20d4db1b072a7aebda42
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

35
Editor/CustomInspectors/EventBaseEditor.cs


using UnityEngine;
using UnityEditor;
using GameplayIngredients.Events;
namespace GameplayIngredients.Editor
{
[CustomEditor(typeof(EventBase), true)]
public class EventBaseEditor : IngredientEditor
{
public override void OnInspectorGUI_PingArea()
{
serializedObject.Update();
EditorGUI.BeginChangeCheck();
string name = this.serializedObject.targetObject.GetType().Name;
DrawBreadCrumb("Event", color, () =>
{
GUILayout.Label(ObjectNames.NicifyVariableName(name));
GUILayout.FlexibleSpace();
OpenIngredientsExplorerButton(serializedObject.targetObject as EventBase);
});
DrawBaseProperties();
if (EditorGUI.EndChangeCheck())
{
serializedObject.ApplyModifiedProperties();
}
}
static readonly Color color = new Color(.1f, .5f, 1f, 1f);
}
}

11
Editor/CustomInspectors/EventBaseEditor.cs.meta


fileFormatVersion: 2
guid: d79c98cc718441a42be87291f563131f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

141
Editor/CustomInspectors/IngredientEditor.cs


using GameplayIngredients.Editor;
using NaughtyAttributes.Editor;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEngine;
public abstract class IngredientEditor : PingableEditor
{
protected List<SerializedProperty> baseProperties;
protected override void OnEnable()
{
base.OnEnable();
if (baseProperties == null)
baseProperties = new List<SerializedProperty>();
else
baseProperties.Clear();
Type inspectedType = this.serializedObject.targetObject.GetType();
foreach (FieldInfo info in inspectedType.FindMembers(MemberTypes.Field,
BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic,
null, null))
{
if (info.IsNotSerialized)
continue;
var property = serializedObject.FindProperty(info.Name);
if (property != null)
baseProperties.Add(property);
}
}
protected void DrawBaseProperties(params string[] excludedNames)
{
EditorGUILayout.Space();
using (new EditorGUI.IndentLevelScope(1))
{
foreach (var prop in baseProperties)
{
if (excludedNames.Any(o => o == prop.name))
continue;
NaughtyEditorGUI.PropertyField_Layout(prop, true);
}
}
DrawButtons();
}
protected void DrawBreadCrumb(string label, Color color, Action content = null)
{
using (new GUILayout.HorizontalScope(Styles.breadCrumbBar))
{
Color c = GUI.backgroundColor;
color *= 0.6f;
color.a = 1;
GUI.backgroundColor = color;
GUILayout.Label(label, Styles.breadCrumb);
GUI.backgroundColor = c;
if (content != null)
using(new GUILayout.HorizontalScope(GUILayout.ExpandWidth(true)))
content.Invoke();
else
GUILayout.FlexibleSpace();
}
}
protected void DrawDebugButton(GUIContent content, Action onClick, params GUILayoutOption[] options)
{
if (GUILayout.Button(content, Styles.drawDebugButton, options))
{
onClick?.Invoke();
}
}
protected void OpenIngredientsExplorerButton(MonoBehaviour target)
{
DrawDebugButton(Styles.callableIconContent, ()=> IngredientsExplorerWindow.OpenWindow(target), GUILayout.Width(28));
}
protected static class Styles
{
public static GUIContent callableIconContent;
public static GUIStyle drawDebugButton;
public static GUIStyle breadCrumb;
public static GUIStyle breadCrumbBar;
static Texture2D bgTexture;
static Styles()
{
callableIconContent = new GUIContent(AssetDatabase.LoadAssetAtPath<Texture2D>("Packages/net.peeweek.gameplay-ingredients/Icons/Misc/ic-callable.png"));
drawDebugButton = new GUIStyle(EditorStyles.miniButton);
drawDebugButton.margin = new RectOffset(1,1,1,1);
drawDebugButton.fixedHeight = 20;
breadCrumbBar = new GUIStyle(EditorStyles.toolbar);
breadCrumbBar.fixedHeight = 22;
breadCrumbBar.margin = new RectOffset(0, 0, 0, 8);
bgTexture = new Texture2D(1, 1);
bgTexture.SetPixel(0, 0, new Color(0, 0, 0, 0.1f));
bgTexture.Apply();
breadCrumbBar.onNormal.background = bgTexture;
breadCrumbBar.onActive.background = bgTexture;
breadCrumbBar.onFocused.background = bgTexture;
breadCrumbBar.onHover.background = bgTexture;
breadCrumbBar.normal.background = bgTexture;
breadCrumbBar.active.background = bgTexture;
breadCrumbBar.focused.background = bgTexture;
breadCrumbBar.hover.background = bgTexture;
var bc = AssetDatabase.LoadAssetAtPath<Texture2D>("Packages/net.peeweek.gameplay-ingredients/Icons/BreadCrumb.png");
breadCrumb = new GUIStyle(EditorStyles.boldLabel);
breadCrumb.fixedHeight = 22;
breadCrumb.border = new RectOffset(8, 28, 0, 0);
breadCrumb.padding = new RectOffset(8, 32, 0, 0);
breadCrumb.margin = new RectOffset();
breadCrumb.onNormal.background = bc;
breadCrumb.onNormal.textColor = Color.white;
breadCrumb.onHover = breadCrumb.onNormal;
breadCrumb.onActive = breadCrumb.onNormal;
breadCrumb.onFocused = breadCrumb.onNormal;
breadCrumb.normal = breadCrumb.onNormal;
breadCrumb.hover = breadCrumb.onNormal;
breadCrumb.active = breadCrumb.onNormal;
breadCrumb.focused = breadCrumb.onNormal;
}
}
}

11
Editor/CustomInspectors/IngredientEditor.cs.meta


fileFormatVersion: 2
guid: 00bb2509da763ac41a97e34a9805687d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

43
Editor/CustomInspectors/LogicBaseEditor.cs


using UnityEngine;
using UnityEditor;
using NaughtyAttributes.Editor;
using GameplayIngredients.Logic;
namespace GameplayIngredients.Editor
{
[CustomEditor(typeof(LogicBase), true)]
public class LogicBaseEditor : IngredientEditor
{
SerializedProperty m_Name;
protected override void OnEnable()
{
base.OnEnable();
m_Name = serializedObject.FindProperty("Name");
}
public override void OnInspectorGUI_PingArea()
{
serializedObject.Update();
EditorGUI.BeginChangeCheck();
DrawBreadCrumb("Logic", color, () =>
{
NaughtyEditorGUI.PropertyField_Layout(m_Name, true);
OpenIngredientsExplorerButton(serializedObject.targetObject as LogicBase);
});
DrawBaseProperties("Name");
if (EditorGUI.EndChangeCheck())
{
serializedObject.ApplyModifiedProperties();
}
}
static readonly Color color = new Color(.5f, 1f, .1f, 1f);
}
}

11
Editor/CustomInspectors/LogicBaseEditor.cs.meta


fileFormatVersion: 2
guid: 099f2422c736e8047ab9561aedbfac78
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

73
Editor/CustomInspectors/RigEditor.cs


using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
using System.Linq;
using NaughtyAttributes.Editor;
using GameplayIngredients.Rigs;
namespace GameplayIngredients.Editor
{
[CustomEditor(typeof(Rig), true)]
public class RigEditor : IngredientEditor
{
SerializedProperty m_UpdateMode;
SerializedProperty m_RigPriority;
protected override void OnEnable()
{
base.OnEnable();
m_UpdateMode = serializedObject.FindProperty("m_UpdateMode");
m_RigPriority = serializedObject.FindProperty("m_RigPriority");
}
public override void OnInspectorGUI_PingArea()
{
serializedObject.Update();
bool excludedRigManager = GameplayIngredientsSettings.currentSettings.excludedeManagers.Any(s => s == "RigManager");
if (excludedRigManager)
{
EditorGUILayout.HelpBox("This Rig depends on the Rig Manager which is excluded in your Gameplay Ingredients Settings. This rig component will be inactive unless the manager is not excluded.", MessageType.Error, true);
if (GUILayout.Button("Open Settings"))
Selection.activeObject = GameplayIngredientsSettings.currentSettings;
}
EditorGUI.BeginDisabledGroup(excludedRigManager);
EditorGUI.BeginChangeCheck();
DrawBreadCrumb("Rig", color, () =>
{
GUILayout.Label(ObjectNames.NicifyVariableName(serializedObject.targetObject.GetType().Name), GUILayout.ExpandWidth(true));
OpenIngredientsExplorerButton(serializedObject.targetObject as Rig);
});
using (new GUILayout.VerticalScope(EditorStyles.helpBox, GUILayout.ExpandWidth(true)))
{
GUILayout.Label("Rig Update Properties", EditorStyles.boldLabel);
using (new EditorGUI.IndentLevelScope(1))
{
NaughtyEditorGUI.PropertyField_Layout(m_UpdateMode, true);
NaughtyEditorGUI.PropertyField_Layout(m_RigPriority, true);
}
}
DrawBaseProperties();
if (EditorGUI.EndChangeCheck())
{
serializedObject.ApplyModifiedProperties();
}
EditorGUI.EndDisabledGroup();
}
static readonly Color color = new Color(1f, .5f, .1f, 1f);
}
}

35
Editor/CustomInspectors/StateEditor.cs


using UnityEngine;
using UnityEditor;
using GameplayIngredients.StateMachines;