Skip to content

InteractableActionSO

Namespace: FireSoftworks.Interaction
Type: Abstract class · ScriptableObject
Assembly: FireSofworks.InteractionSystem
Implements: IInteractableAction

Abstract ScriptableObject base for reusable, data-driven actions. Create one asset and assign it to many InteractableTarget.soActions lists — no component duplication per object.

public class InteractableActionSO : ScriptableObject, IInteractableAction

Creating an SO action

[CreateAssetMenu(
menuName = "FireSoftworks/Interaction/Inspect Action SO",
fileName = "InspectActionSO")]
public class InspectActionSO : InteractableActionSO
{
[SerializeField] private string _text = "Nothing special here.";
public override bool IsAvailable(InteractionContext context) => true;
public override void Execute(InteractionContext context)
{
Debug.Log(_text);
OnExecuted?.Invoke(context);
}
}

Then right-click in the Project window → Create › FireSoftworks › Interaction › Inspect Action SO to create an asset, and drag it into any InteractableTarget’s SO Actions list.


Inspector fields

FieldTypeDescription
idstringTechnical identifier (default "action").
displayNamestringHUD label (default "Action").
iconSpriteOptional HUD icon.
onExecutedUnityEvent<InteractionContext>Shared callbacks wired on the asset.

Properties

Id

public string Id { get; }

Label

public string Label { get; }

Icon

public Sprite Icon { get; }

ShowWhenUnavailable

public virtual bool ShowWhenUnavailable { get; }

Returns true by default.

OnExecuted

public UnityEvent<InteractionContext> OnExecuted { get; }

Virtual methods

IsAvailable(InteractionContext)

public virtual bool IsAvailable(InteractionContext context)

Default: returns true. Override to add shared availability logic.

Execute(InteractionContext)

public virtual void Execute(InteractionContext context)

Default: invokes OnExecuted. Override with your shared action logic.


Per-instance state

SO assets are shared — they cannot store per-object state safely. If you need per-instance state (e.g., a “used” flag per chest), use InteractableActionSOWrapper instead.