logo SERENITY
Game Systems Foundation
Search Results for

    Show / Hide Table of Contents

    Class UnityFeedbackService

    Unity MonoBehaviour implementation of IFeedbackService and IFeedbackRuntime. Routes each effect of a definition to every channel that can play it, and owns the single global stop/lifecycle safety net (application focus/pause, scene unload, play-mode exit, disable/destroy, and the vibration-disabled setting). Per-effect timing/restoration is owned by each channel via the coroutine host this class exposes through IFeedbackRuntime.

    Inheritance
    object
    UnityFeedbackService
    Implements
    IFeedbackService
    IService
    IFoundationSettings
    IFeedbackRuntime
    Namespace: Serenity.Feedback.Infrastructure.Services
    Assembly: Serenity.UnityFeedback.Infrastructure.dll
    Syntax
    public class UnityFeedbackService : MonoBehaviour, IFeedbackService, IService, IFoundationSettings, IFeedbackRuntime

    Constructors

    UnityFeedbackService()

    Declaration
    public UnityFeedbackService()

    Fields

    Guid

    Declaration
    public string Guid
    Field Value
    Type Description
    string

    GUID for this service instance.

    Id

    Declaration
    public string Id
    Field Value
    Type Description
    string

    Unique identifier for this service instance.

    _channels

    Declaration
    protected List<IFeedbackChannel> _channels
    Field Value
    Type Description
    List<IFeedbackChannel>

    _definitionProvider

    Declaration
    protected IFeedbackDefinitionProvider _definitionProvider
    Field Value
    Type Description
    IFeedbackDefinitionProvider

    _eventDispatcherService

    Declaration
    protected IEventDispatcherService _eventDispatcherService
    Field Value
    Type Description
    IEventDispatcherService

    _gameSettingsService

    Declaration
    protected IGameSettingsService _gameSettingsService
    Field Value
    Type Description
    IGameSettingsService

    _globalEnabled

    Declaration
    protected bool _globalEnabled
    Field Value
    Type Description
    bool

    _globalIntensity

    Declaration
    protected float _globalIntensity
    Field Value
    Type Description
    float

    _logService

    Declaration
    protected ILogService _logService
    Field Value
    Type Description
    ILogService

    _menuSubmitDefinitionId

    Declaration
    protected string _menuSubmitDefinitionId
    Field Value
    Type Description
    string

    _menuTickDefinitionId

    Declaration
    protected string _menuTickDefinitionId
    Field Value
    Type Description
    string

    _resolver

    Declaration
    protected UnityGamepadTargetResolver _resolver
    Field Value
    Type Description
    UnityGamepadTargetResolver

    _runtimeCoroutines

    Declaration
    protected readonly Dictionary<object, Coroutine> _runtimeCoroutines
    Field Value
    Type Description
    Dictionary<object, Coroutine>

    _vibrationEnabledSettingId

    Declaration
    protected string _vibrationEnabledSettingId
    Field Value
    Type Description
    string

    _vibrationIntensitySettingId

    Declaration
    protected string _vibrationIntensitySettingId
    Field Value
    Type Description
    string

    Properties

    IsEnabled

    Declaration
    public bool IsEnabled { get; }
    Property Value
    Type Description
    bool

    LogService

    Declaration
    public ILogService LogService { get; set; }
    Property Value
    Type Description
    ILogService

    MenuSubmitDefinitionId

    Declaration
    public string MenuSubmitDefinitionId { get; }
    Property Value
    Type Description
    string

    MenuTickDefinitionId

    Declaration
    public string MenuTickDefinitionId { get; }
    Property Value
    Type Description
    string

    Methods

    Cancel(object)

    Declaration
    public virtual void Cancel(object handle)
    Parameters
    Type Name Description
    object handle

    Initialize(IGameSettingsService, IFeedbackSettings, IFeedbackDefinitionProvider, List<IFeedbackChannel>, IEventDispatcherService, ILogService)

    Initializes the service with all required dependencies. Called by the installer after the service exists and the channels (which take this instance as their IFeedbackRuntime) have been constructed.

    Declaration
    public void Initialize(IGameSettingsService gameSettingsService, IFeedbackSettings settings, IFeedbackDefinitionProvider definitionProvider, List<IFeedbackChannel> channels, IEventDispatcherService eventDispatcherService, ILogService logService)
    Parameters
    Type Name Description
    IGameSettingsService gameSettingsService
    IFeedbackSettings settings
    IFeedbackDefinitionProvider definitionProvider
    List<IFeedbackChannel> channels
    IEventDispatcherService eventDispatcherService
    ILogService logService

    Play(FeedbackDefinitionData)

    Declaration
    public virtual void Play(FeedbackDefinitionData definition)
    Parameters
    Type Name Description
    FeedbackDefinitionData definition

    Play(string)

    Declaration
    public virtual void Play(string definitionId)
    Parameters
    Type Name Description
    string definitionId

    PlayForDevice(string, FeedbackDefinitionData)

    Declaration
    public virtual void PlayForDevice(string deviceId, FeedbackDefinitionData definition)
    Parameters
    Type Name Description
    string deviceId
    FeedbackDefinitionData definition

    PlayForDevice(string, string)

    Declaration
    public virtual void PlayForDevice(string deviceId, string definitionId)
    Parameters
    Type Name Description
    string deviceId
    string definitionId

    PlayForPlayer(int, FeedbackDefinitionData)

    Declaration
    public virtual void PlayForPlayer(int playerIndex, FeedbackDefinitionData definition)
    Parameters
    Type Name Description
    int playerIndex
    FeedbackDefinitionData definition

    PlayForPlayer(int, string)

    Declaration
    public virtual void PlayForPlayer(int playerIndex, string definitionId)
    Parameters
    Type Name Description
    int playerIndex
    string definitionId

    PlayForPlayerInput(object, FeedbackDefinitionData)

    Declaration
    public virtual void PlayForPlayerInput(object playerInput, FeedbackDefinitionData definition)
    Parameters
    Type Name Description
    object playerInput
    FeedbackDefinitionData definition

    PlayForPlayerInput(object, string)

    Declaration
    public virtual void PlayForPlayerInput(object playerInput, string definitionId)
    Parameters
    Type Name Description
    object playerInput
    string definitionId

    Run(IEnumerator, object)

    Declaration
    public virtual void Run(IEnumerator routine, object handle)
    Parameters
    Type Name Description
    IEnumerator routine
    object handle

    SetGlobalEnabled(bool)

    Declaration
    public virtual void SetGlobalEnabled(bool enabled)
    Parameters
    Type Name Description
    bool enabled

    SetGlobalIntensity(float)

    Declaration
    public virtual void SetGlobalIntensity(float intensity01)
    Parameters
    Type Name Description
    float intensity01

    StopAll()

    Declaration
    public virtual void StopAll()

    Implements

    IFeedbackService
    IService
    IFoundationSettings
    IFeedbackRuntime
    In this article
    © 2026 Serenity. All Rights Reserved