This page explains what MMTools are and how to use them

The MMFeedbacks Component

The main component you’ll interact with is called MMFeedbacks. To use it, create an empty game object, and add a MMFeedbacks component to it. From its inspector, you’ll be able to set a number of generic settings, and then you can start adding and tweaking feedbacks using the “Add new feedback” dropdown. You can reorder feedbacks by dragging them with the left most icon, fold/unfold them, disable them individually using the checkbox, rename them by editing their label field, and remove and copy them using the rightmost dropdown.

The MMFeedbacks component

Once you’ve added some feedbacks, you’ll probably want to play these feedbacks. There are two simple ways to do so (but feel free to do things differently) :

  • via Unity events : on your buttons or any other components that use events, simply drag and drop your MMFeedbacks object into an event’s slot, and bind its PlayFeedbacks method. Every time that event will get fired, your feedback will play.
  • via code : in one of your classes that you want to add some feedback to, declare a public MMFeedbacks variable, bind it to your newly created MMFeedbacks object from its inspector, and at the place in your code where you’d like the feedback to happen, call its PlayFeedbacks method. You may also want to call the Initialization, StopFeedbacks and ResetFeedbacks methods as well.

The following example shows how a class responsible for having a player jump uses MMFeedbacks to make that better :

using UnityEngine;
using MoreMountains.Feedbacks;

public class CharacterJump : MonoBehaviour
{
    // we declare a public MMFeedbacks reference, that we'll set from our CharacterJump inspector
    public MMFeedbacks JumpFeedback;

    public void Jump()
    {
      // here we'd put our Jump code
      JumpFeedback.PlayFeedbacks();
    }
}

Note that you can also try them at runtime in debug mode, directly from the inspector, via the bottom button bar, that will allow you to test the Initialize, Play, Stop and Reset methods. You can also test them individually via the dropdown on the right of each Feedback’s title bar.

In each feedback’s inspector you’ll find a Timing dropdown. This allows you to fine tune things such as initial delay, cooldown duration (the minimum time between two plays of that feedback), and repeat options.

On each feedback you’ll also find a Chance slider, that goes from 0 to 100. This represents the percentage of chance that this feedback has to actually happen when played. 100 means all the time, 0 means never, 25 means once every 4 times, etc.

MMFeedbacks settings

At the top of each MMFeedbacks you’ll find a foldable Settings section, from there you’ll be able to tweak settings that will apply at the MMFeedbacks level.

Jekyll
The MMFeedbacks settings panel

Initialization :

  • Safe Mode : the mode you select here will define when checks are performed to make sure no serialization error has happened and potentially damaged the feedbacks. Nope : no safety, editor only : performs checks on enable, runtime only : performs checks on Awake, full : performs both editor and runtime checks. That last one is the recommended setting.
  • Initialization Mode : the possible initialization modes. If you use Script, you’ll have to initialize manually by calling the Initialization method and passing it an owner. Otherwise, you can have this component initialize itself at Awake or Start, and in this case the owner will be the MMFeedbacks itself. In most cases you can just go with Start and you’ll be fine.
  • Auto Play on Start : whether or not this MMFeedbacks should play when the scene starts
  • Auto Play on Enable : whether or not this MMFeedbacks should play on Enable

Direction :

  • Direction : this defines the order in which feedbacks will be played. By default it’ll be from top to bottom, but you can decide to have them play from bottom to top instead
  • Auto Change Direction on End : whether or not this MMFeedbacks should automatically invert its direction when all feedbacks have played

Intensity :

  • Feedbacks Intensity : the intensity at which to play this feedback. That value will be used by most feedbacks to tune their amplitude. 1 is normal, 0.5 is half power, 0 is no effect. Note that what this value controls depends from feedback to feedback, don’t hesitate to check the code to see what it does exactly.

Timing :

  • Duration Multiplier : a time multiplier that will be applied to all feedback durations (initial delay, duration, delay between repeats…
  • Display Full Duration Details : if this is true, more editor-only, detailed info will be displayed per feedback in the duration slot
  • Cooldown Duration : a duration, in seconds, during which triggering a new play of this MMFeedbacks after it’s been played once will be impossible
  • Initial Delay : a duration, in seconds, to delay the start of this MMFeedbacks’ contents play

Events :

  • Trigger MMFeedbacks Events : whether or not this MMFeedbacks should fire MMFeedbacksEvents, a type of events you can decide to listen to from any class
  • Trigger Unity Events : whether or not this MMFeedbacks should fire regular Unity Events, as bound in the inspector using the events slots described below
  • OnPlay : this event will fire every time this MMFeedbacks gets played
  • OnPause : this event will fire every time this MMFeedbacks gets paused
  • OnResume : this event will fire every time this MMFeedbacks gets resumed
  • OnRevert : this event will fire every time this MMFeedbacks gets reverted (usually automatically at the end of a play, if AutoChangeDirectionOnEnd is true, or when calling its Revert() method)
  • OnComplete : this event will fire every time this MMFeedbacks plays its last MMFeedback

MMFeedbacks controls

At the bottom of each MMFeedbacks component, you’ll find generic controls :

Jekyll
The MMFeedbacks control panel
  • Add new feedback : opens a dropdown from which to pick a new MMFeedback to add to the list
  • Copy all : copies all feedbacks. You can then go and paste them (via a button that will appear in the same section) on any other MMFeedbacks. This is the only recommended way to copy feedbacks from one to the other. Do not use Unity’s “copy component values” feature.
  • Initialize, Play, Stop, Pause, Revert : calls the corresponding methods on that MMFeedbacks, for test purposes only. Most of these will only be available at runtime.
  • Debug View : unhides debug panels, use at your own risks