This page lists a few 'recipes' that will teach you in a few steps how to do common tasks using Feel

Introduction

Want to get started quickly with Feel? This page contains simple steps you can follow for a number of basic situations, no explanations, just quick steps. Don’t hesitate to check the rest of the documentation to learn more about how the engine works. And if you’re wondering how to achieve something, or would like to see a particular recipe on this page, don’t hesitate to make suggestions!

Note that most of these will provide Feel / Unity versions, that’s just to provide the context they were first written in. But it’s safe to assume that they should work on any higher versions of both Unity and Feel.

How to install Feel in your project?

To add Feel to your project, simply follow the simple steps below :

  1. using 2020.3.48f1 (or a recent version of Unity of your choice), create a new project, pick the “3D” template
  2. via the Package Manager, go to the Feel page, click the download button, then the import button
  3. wait until a “import Unity package” popup appears, make sure everything is checked (it should be by default), click “import”
  4. open Unity’s Package Manager, install the latest version of the Post Processing package
  5. in the package manager, install the latest version of the Cinemachine package
  6. in the package manager, install the latest version of the TextMesh Pro package
  7. in the package manager, install the latest version of the Animation 2D package (this is only useful for the Letters demo)
  8. open the MMFPlayerDemo scene (or any other demo), press play, enjoy

How to use MMF Player to trigger a particle system?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. create a new scene
  3. create a new empty object in it, add a particle system component to it
  4. let’s make it a bit prettier, under its Renderer panel, click on the Material dot on the right of the field, and pick the FeelSnakeEatParticlesMaterial
  5. under its Emission foldout, set RateOverTime to 0, and add a Burst instead by pressing the little “+” under Bursts (default settings will do)
  6. towards the top of the inspector, set the StartLifetime to 0.5
  7. then check SizeOverLifetime down in the list of foldouts, and set its size curve to any of the default downward curves
  8. if you were to play your particle system, you should see a bunch of bubbles shrinking down rapidly
  9. now create a new empty object, call it MyTestFeedbacks, add a MMF Player component to it
  10. add a ParticlesPlay feedback to it, and drag the particle system you’ve created into its BoundParticleSystem slot
  11. press play in your editor, then select your MyTestFeedbacks object, and in its MMF Player’s inspector, press the green Play button
  12. now you know how to trigger particle systems via MMF Player. Note that there are other ways to do it, for example you could decide to make a prefab out of your particle system, and instead use the ParticleInstantiation feedback

How to setup a Cinemachine camera shake (the recommended way to do camera shake)

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. from the Package Manager, import Cinemachine
  3. create a new empty scene
  4. add a cube, position it at 0,0,0
  5. via the Cinemachine menu in the top menu, create a new virtual camera
  6. select your virtual camera, and via its AddExtensions dropdown, add an impulse listener
  7. create an empty game object, call it MyTestFeedbacks, add a MMF Player component to it, position it at 0,0,0
  8. add a new Cinemachine Impulse feedback to it, via its “Add new feedback” dropdown
  9. from its inspector, click the little cog at the end of the RawSignal field and select Presets > 6D Shake (if the cog icon doesn’t work - it’s a known Cinemachine bug, you’ll find the same presets in Packages/Cinemachine/Presets/Noise/, and can just drag them into your impulse feedback inspector)
  10. set its Velocity (at the bottom of the inspector) to 5,5,5
  11. press play in the editor, select the MyTestFeedbacks object, and in its MMF Player inspector, press the green Play button
  12. CAMERA SHAKE!

How to setup a regular, non-Cinemachine camera shake

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. create a new empty scene
  3. add a cube, position it at 0,0,0
  4. create an empty game object at the camera’s position, call it CameraRig
  5. create an empty game object at the camera’s position, call it CameraShaker, nest it under CameraRig
  6. nest your Camera under CameraShaker (you should have CameraRig > CameraShaker > MainCamera)
  7. on your CameraShaker node, add a MMCameraShaker component
  8. on its MMWiggle, check Position, select Noise as wiggle type, uncheck wiggle permitted
  9. create an empty game object, call it MyTestFeedbacks, add a MMF Player component to it
  10. add new feedback > camera > camera shake
  11. press play, then Play on your MyTestFeedbacks inspector, camera will shake

How to setup a Cinemachine Impulse Source feedback

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. from the Package Manager, import Cinemachine
  3. create a new empty scene
  4. add a cube, position it at 0,0,0
  5. via the Cinemachine menu in the top menu, create a new virtual camera
  6. select your virtual camera, and via its AddExtensions dropdown, add an impulse listener
  7. create an empty game object, call it MyTestFeedbacks, add a MMF Player component to it, position it at 0,0,0
  8. add a CinemachineImpulseSource feedback to it
  9. via the AddComponent button, add a Cinemachine Impulse Source, drag that component into the ImpulseSource field on your feedback
  10. press play, then Play on your MyTestFeedbacks inspector, camera will shake

How to setup a regular camera shake but still target virtual cameras

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. from the Package Manager, import Cinemachine
  3. create a new, empty scene, add a Cube to it, position it at 0,0,0
  4. create a new Cinemachine virtual camera, position it so that it “sees” the cube
  5. on the virtual camera, set Noise to BasicMultiChannelPerlin, set NoiseProfile to 6D Shake, AmplitudeGain:0 and FrequencyGain:0
  6. add a MMCinemachineCameraShaker to it
  7. create a new empty game object, add a MMF Player to it, add a Camera > Camera Shake feedback to it, unfold its CameraShakeProperties and set all Duration:0.3, Amplitude:2, Frequency:40
  8. press play in the editor, then play on the MMF Player

How to use Feel with URP?

  1. in Unity, create a new project using the URP template
  2. from the Package Manager, import the latest version of Feel
  3. that’s it, you can now use Feel with your URP project

Ok and how to use MMF Player with URP volumes then?

  1. after the steps described above :
  2. create a new scene
  3. in it, add a cube, position it at 0,0,0
  4. create a new Global Volume (right click, volume > global volume in your Hierarchy panel)
  5. press the New button next to Profile in its inspector
  6. add an override to it, pick Vignette, set the Vignette’s intensity to 0.5
  7. add a new component to the global volume, in the add component menu type MMVignetteShaker_URP
  8. select the MainCamera, in its inspector under Rendering, check PostProcessing
  9. you should now see the Vignette in your Game view
  10. create an empty game object, call it MyTestFeedbacks, add a MMF Player component to it
  11. press the “add new feedback” dropdown and select PostProcess > Vignette URP
  12. in its inspector, set Remap Intensity Zero to 0.5
  13. press play in the editor, select the MyTestFeedbacks object, and in its MMF Player’s inspector, press the green Play button
  14. now you know how to trigger volume feedbacks. To target other post processing filters, make sure you add the corresponding Shaker on the Volume

How to change a feedback's property via script at runtime?

For plenty of reasons, you may want to change a property or more on a feedback at runtime. It’s of course possible, and in this example we’ll see how we can change the intensity of a Chromatic Aberration feedback in the Duck demo. It’d be the exact same logic for any other property, on any other feedback.

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. open the FeelDuck demo scene
  3. create a new, empty gameobject, call it RuntimeTest
  4. outside of the Feel folder, create a new C# script, call it RuntimeTest, and paste the following in it :
using MoreMountains.Feedbacks;
using MoreMountains.FeedbacksForThirdParty;
using MoreMountains.Tools;
using UnityEngine;

public class RuntimeTest : MonoBehaviour
{
    public MMFeedbacks TargetFeedback;
    [Range(-100f, 100f)]
    public float Intensity = 0f;
    [MMInspectorButton("TestFeedback")]
    public bool PlayFeedbackBtn;

    private MMFeedbackLensDistortion _lensDistortion;
    // IMPORTANT : if you're using a MMF Player, replace the line above with this:
    // private MMF_LensDistortion _lensDistortion;

    private void Start()
    {
        // on start we store our lens distortion feedback component, so that we can target it later on
        _lensDistortion = TargetFeedback.GetComponent<MMFeedbackLensDistortion>();

        // IMPORTANT : if you're using a MMF Player, replace the line above with this:
        // _lensDistortion = TargetFeedback.GetFeedbackOfType<MMF_LensDistortion>();
    }

    public void TestFeedback()
    {
        // we modify our RemapIntensityOne value before playing our feedback.
        // This is done like for any other public attribute on any component in Unity
        if (_lensDistortion != null)
        {
            _lensDistortion.RemapIntensityOne = Intensity;
        }
        // we then play our MMFeedbacks
        TargetFeedback?.PlayFeedbacks();
    }
}
  1. then add that script to your RuntimeTest game object
  2. select your RuntimeTest object, and drag the FeelDuckLandingFeedback object from your Hierarchy panel into the RuntimeTest’s TargetFeedback slot in its inspector
  3. press play in the editor, then select your RuntimeTest object, change the intensity value in your inspector, and press the TestFeedback button, every time you’ll play, the value you’ve changed in the inspector will be sent to the feedback before it plays

One important thing to keep in mind when changing values at runtime is that some of them will get cached for performance reason. So always double check that the value you’re interacting with doesn’t get cached at some point, and that you’re targeting the correct property, or resetting the cache if needed.

How to play a feedback in reverse?

  1. select your MMF_Player, and in its Settings foldout, set Direction to BottomToTop
  2. you can also force that via code :
    MyPlayer.Direction = MMFeedbacks.Directions.BottomToTop;
    MyPlayer.PlayFeedbacks();
    
  3. you can learn more about direction options in the dedicated section of the documentation

How to revert a feedback as it's playing?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. in a new empty scene, add a cube, position it at 0,0,0
  3. add a new empty, add a MMF Player to it, add a Position feedback, target:Cube, duration:5, destination position:0,5,0
  4. press play in the editor, then the green play button, then the Revert button after 2s
  5. you can of course do that via code as well, simply by calling the Revert() method on your MMF Player

How to trigger a MMF Player with Playmaker?

Note : there are plenty of other ways to do it, and this will also (most of the time) be the same general logic for Bolt and other visual scripting tools.

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. install Playmaker
  3. in a new scene, create an empty object, call it MyFeedbacks, add a MMF Player component to it
  4. add a Debug Log feedback to it, set its Debug Message to “Hello!”
  5. open the Playmaker editor, right click in it to add a FSM
  6. rename that first state to “GettingInput”, and using the Action Browser, add a GetKeyDown action, set its key to F2
  7. in the Send Event dropdown, select New Event, name it “F2Pressed”, and press the CreateEvent button, then click on the red label to add transition to state
  8. right click in the FSM to add a new state, call it “PlayingFeedbacks”
  9. right click on the first state’s F2Pressed event, set its transition target to PlayingFeedbacks
  10. right click on the PlayingFeedbacks state, add transition > Finished, then right click on Finished and set its transition target to GettingInput
  11. in the PlayingFeedbacks state, using the Action Browser, add a CallMethod action, drag MyFeedbacks’ MMF Player monobehaviour into its Behaviour slot, and in the Method dropdown, select “void PlayFeedbacks()”
  12. press play in your Unity editor, now every time you’ll press F2, the feedback will play, and “Hello!” will appear in the console. Any other feedbacks you’d add to your MyFeedbacks MMF Player will of course also play
Jekyll
The PlayingFeedbacks state

How to setup a camera zoom feedback?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. from the Package Manager, import Cinemachine
  3. create a new empty scene
  4. add a cube, position it at 0,0,0
  5. select your MainCamera, add a MMCameraZoom component to it
  6. create an empty game object, call it MyTestFeedbacks, add a MMF Player component to it
  7. add a Camera > Camera Zoom feedback to it, via its “Add new feedback” dropdown
  8. press play in the editor, select the MyTestFeedbacks object, and in its MMF Player inspector, press the green Play button

How to trigger MMF Player via the Timeline

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. for this example we’ll open the FeelDuck demo scene
  3. create a new empty object, call it Director
  4. open the Timeline panel (Window > Sequencing > Timeline)
  5. in the Timeline panel, press the Create (a director) button, call the new asset TimelineDirector, save it in your project
  6. drag the FeelDuckBackground into the Timeline, and pick “Add activation track”
  7. copy the Active block, move the new one to the right, you should now have two Active blocks, maybe with a bit of a gap between them, that’s our Timeline animation (it’ll activate/disable/activate the background, of course you may want to do more fancy stuff in your own Timeline, that just gives us a track to play)
  8. press the little pin icon under the frame count to reveal our markers track
  9. around frame 120, right click in the marker track and select “Add signal emitter”
  10. in the inspector, click on Create Signal, name the new asset “TestMMFPlayer.signal”, save it in your project
  11. in the inspector, click on “Add signal receiver”
  12. select your Director object, and in its inspector, drag the FeelDuckJumpStartFeedback into the SignalReceiver’s event reaction slot, select its MMF Player > PlayFeedbacks() method as its reaction
  13. press play in the editor, then press play in your timeline, your feedback will play everytime the play head passes the marker
  14. don’t hesitate to check https://blog.unity.com/technology/how-to-use-timeline-signals to learn more about how Timeline and Signals work

How to setup a MMFader and fade feedback?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. create a new, empty scene
  3. add a UI Image to your scene, set its RectTransform so that it covers the entire screen (usually full stretch and 0 on all left/right/top/bottom, set its Image color to black
  4. add a MMFader component to it, this will add a CanvasGroup, set its Alpha to 0
  5. in the scene, create a new empty object, add a MMF Player to it, add a Camera > Fade feedback to it
  6. press play, play the Feedback, it will “fade in” the fader (fading the screen to black), change its FadeType to Fade Out, it will fade it out back to normal. The Fade feedback’s inspector will let you tweak settings to your liking (duration, curve, etc). If you have more than one fader, make sure the Channel ID on both your fader and feedbacks match.

How to setup a simple Position feedback?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. create a new, empty scene, add a cube to it, position it at 0,0,0
  3. add a new, empty game object, add a MMF Player component to it
  4. add a Transform > Position feedback to it
  5. drag the Cube in its AnimatePositionTarget slot
  6. set Transition Mode to Along Curve, AnimatePositionDuration: 1, AnimateX:true
  7. press play, play the feedback

How to setup a Scale To Destination feedback?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. create a new, empty scene, add a Cube to it
  3. create a new empty object, add a MMF Player to it
  4. add a Transform > Scale feedback, set the Cube as its AnimateScaleTarget
  5. set Mode:ToDestination, RemapCurveZero:0, RemapCurveOne:1, check all AnimateXYZ checkboxes, set all curves to an ascending curve (0,0 to 1,1)
  6. press play in the editor, set DestinationScale to 0.5,0.5,0.5, press Play on that feedback, your cube will shrink
  7. set DestinationScale to 0,0,0, press Play on that feedback, your cube will shrink even more
  8. set DestinationScale to 1,1,1, press Play on that feedback, your cube will go back to its initial scale

How to use the MMHealthBar component to automatically draw health bars?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. create a new, empty scene
  3. create a cube, position it at 0,0,0
  4. add a MMHealthBar component to it
  5. press play, you’ll notice the healthbar gets drawn above your cube
  6. if you now want to interact with your MMHealthBar and update it, you’ll need to pass it data to update it. We’ll use a script to do so.
  7. create a new C# class, call it TestMMHealthBar, and paste the following in it :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.Tools;

/// <summary>
/// A simple class used to interact with a MMHealthBar component and test it
/// To use it, add it to an object with a MMHealthBar, and at runtime, move its CurrentHealth slider, and press the Test button to update the bar
/// </summary>
public class TestMMHealthBar : MonoBehaviour
{
    [Range(0f, 100f)]
    public float CurrentHealth = 50f;

    protected float _minimumHealth = 0f;
    protected float _maximumHealth = 100f;
    protected MMHealthBar _targetHealthBar;

    [MMInspectorButton("Test")] public bool TestButton;

    protected virtual void Awake()
    {
        _targetHealthBar = this.gameObject.GetComponent<MMHealthBar>();
    }

    public virtual void Test()
    {
        if (_targetHealthBar != null)
        {
            _targetHealthBar.UpdateBar(CurrentHealth, _minimumHealth, _maximumHealth, true);    
        }
    }
}
  1. add this component to your Cube, press play, and at runtime, move its CurrentHealth slider in its inspector. Every time you press the Test button, the health bar will update.

How to setup floating texts to play them via feedbacks?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. in an empty scene (or your scene), create a new empty gameobject, name it “FloatingTextSpawner”, add a MMFloatingTextSpawner component to it.
  3. in your project panel, search for the MMFloatingText prefab, and drag it into the newly created spawner, under its Pooler settings, in the PooledSimpleMMFloatingText slot
  4. create a new empty object, call it “TestPlayer”, position it at 0,0,0, then add a MMF Player component to it
  5. add a new UI > Floating Text feedback to it
  6. press play in the editor, then the green Play button on your MMF Player, you’ll see a “100” text spawn every time

Going further : adding intensity control

  • to go further, you can check the “use intensity as value” to have it apply your MMF Player’s intensity to the feedback, like in the following class. To test it, create a new class in your project with the following code, then after the steps above, add the TestIntensityAsValue component to your MMF Player. Press play in the editor, then its TriggerFeedback button, a random value will pop every time. Of course you’ll likely want to pass it some damage value instead of a random one! You’ll notice the value isn’t rounded, if you’d like to change that, you can select a rounding method on your Floating Text feedback.
using MoreMountains.Feedbacks;
using UnityEngine;

public class TestIntensityAsValue : MonoBehaviour
{
	[MMFInspectorButton("TriggerFeedback")]
	public bool TriggerFeedbackButton;
	private MMF_Player _myPlayer;

	private void Start()
	{
		// on start we grab our MMF Player component
		_myPlayer = this.gameObject.GetComponent<MMF_Player>();
	}

	private void TriggerFeedback()
	{
		float randomIntensity = Random.Range(0f, 100f);
		_myPlayer.PlayFeedbacks(this.transform.position, randomIntensity);
	}
}

Going even further : changing values at runtime

  • you can also dynamically change the Value attribute of that MMFeedbackFloatingText component to anything you want, as well as all its other properties. In the example below, we set the value to a random float, and the color to some fancy gradient.
using MoreMountains.Feedbacks;
using UnityEngine;

public class TestModifyAtRuntime : MonoBehaviour
{
	[MMFInspectorButton("TriggerFeedback")]
	public bool TriggerFeedbackButton;

	private MMF_Player _myPlayer;
	private Gradient gradient;
	private GradientColorKey[] colorKey;
	private GradientAlphaKey[] alphaKey;

	private void Start()
	{
		// on start we grab our MMF Player component
		_myPlayer = this.gameObject.GetComponent<MMF_Player>();
	}

	private void TriggerFeedback()
	{
		float randomValue = Mathf.Round(Random.Range(0f, 100f));
		MMF_FloatingText floatingText = _myPlayer.GetFeedbackOfType<MMF_FloatingText>(); // note that this assumes you only have one floating text feedback in your player, see docs for more advanced ways of grabbing it

		// we apply a random value as our display value
		floatingText.Value = randomValue.ToString();

		// we setup some fancy colors
		gradient = new Gradient();
		// Populate the color keys at the relative time 0 and 1 (0 and 100%)
		colorKey = new GradientColorKey[2];
		colorKey[0].color = Color.red;
		colorKey[0].time = 0.0f;
		colorKey[1].color = Color.blue;
		colorKey[1].time = 1.0f;
		// Populate the alpha  keys at relative time 0 and 1  (0 and 100%)
		alphaKey = new GradientAlphaKey[2];
		alphaKey[0].alpha = 1.0f;
		alphaKey[0].time = 0.0f;
		alphaKey[1].alpha = 0.0f;
		alphaKey[1].time = 1.0f;
		gradient.SetKeys(colorKey, alphaKey);

		floatingText.ForceColor = true;
		floatingText.AnimateColorGradient = gradient;

		_myPlayer.PlayFeedbacks(this.transform.position);
	}
}

How to make an object wiggle in your scene?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. in a new scene, create a cube
  3. add a MMWiggle component to it
  4. check the Position checkbox, set its Wiggle Type to Noise, press play, you now have a wiggling cube
  5. you can now increase the frequency, amplitude, or add a shift (useful if you have more than one of these), and play with all the other options

Setting up a MMBlink component

The MMBlink component will let you define blinking sequences on objects, and you can then use a MMBlink MMFeedback to trigger it. Here’s one way to set it up :

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. in a new scene, create a new sprite renderer, set its sprite to “button-A” (or any sprite of your choice)
  3. add a MMBlink component to it, set its Method to Material Alpha, and drag the Sprite Renderer into the MMBlink’s TargetRenderer slot
  4. then we’ll want to define our blink sequence, set the Phases array’s size to 2
  5. under the array’s Element 0, set PhaseDuration to 1, OffDuration to 0.3, OnDuration to 0.7
  6. under the array’s Element 1, set PhaseDuration to 0.5, OffDuration to 0.2, OnDuration to 0.3
  7. set the Repeat Count to -1 (which will have it repeat forever)
  8. press play, the sprite will now blink in repeating patterns

Now to have a MMF Player trigger it :

  1. uncheck Blinking on the MMBlink, and set the RepeatCount to 5
  2. create a new empty game object, call it MyTestFeedbacks, add a MMF Player to it
  3. add a new MMBlink feedback (renderer > MMBlink), and drag the MMBlink object into its TargetBlink slot
  4. press play in your editor, then press Play on the MyTestFeedbacks’ inspector’s test button, the sprite will blink for 5 sequences

The MMBlink component offers quite a few options, letting you blink objects by enabling/disabling objects, playing on their alpha, emission, or simply any float on their material’s shader. You can also have it lerp these values (change the Element0 and Element1’s On/Off Lerp Durations to 0.5 to test that)

How to play a random sound with randomized volume?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. create a new scene, open it
  3. create an empty object, add a MMSoundManager to it
  4. create another empty, add a MMF Player to it
  5. add a MMSoundManager Sound feedback to it
  6. set its random sfx array size to 2, set the first element to FeelBlobNote1, the second to FeelBlobNote2
  7. set the min volume to 0.2, max volume to 0.5
  8. press play in the editor, then press the green Play button at the bottom of your MMF Player, everytime you’ll play a new volume will be randomized

How to setup a flicker feedback?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. create a new empty scene, add a Cube to it
  3. create a new empty object, name it Player, add a MMF Player to it
  4. add a Flicker feedback to it, drag the Cube into the BoundRenderer slot
  5. press Play in the editor, then the green Play button in the MMF Player’s inspector, your cube will flicker and return to its original color after 0.2s

How to setup a shader controller and pilot it with a feedback?

Note : these steps use BiRP’s PostProcessing stack, if you’re using URP or HDRP, adapt these to use Volumes instead.

Setting up our scene so that emission is visible

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. create a new, empty scene, add a Cube to it, position it at 0,0,0
  3. create a new empty object, name it Volume, add a PostProcessVolume to it, set IsGlobal:true, add a new profile to it, and add a Bloom effect override, set its Intensity to 1
  4. on your scene’s main camera, add a PostProcessLayer, Layer:Everything
  5. set the Cube’s MeshRenderer to FeedbacksDemoBurger. Notice that this material’s shader exposes an _EmissionForce float property, that controls (you guessed it) the strength of its emission

Adding a shader controller

  1. add a ShaderController component on the Cube, drag the MeshRenderer into its TargetRenderer slot, TargetPropertyName:_EmissionForce
  2. press play in the editor, notice that the cube’s emission is now pulsating, as the shader controller is in PingPong mode by default

Controlling the shader controller via a feedback

  1. exit play mode, set the ShaderController’s ControlMode to OneTime
  2. create a new empty object, add a MMF Player to it, then add a Renderer > ShaderController feedback to it, drag the Cube into its TargetShaderController slot, OneTimeRemapMax:10
  3. press play in the editor, then press the green Play button on your MMF Player, the cube will glow and get back to its normal emission over 1s

How to setup a channel asset on a feedback and shaker?

In this example, we’ll setup a scale shaker and use a scale shake feedback to trigger it. The same logic applies to all shakers and feedbacks targeting them.

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager, create a new empty scene
  2. create a new Cube in the scene, position it at 0,0,0, add a MMScaleShaker to it
  3. press play, in its inspector, under the Test foldout, press the StartShaking button, notice our cube shakes its scale over half a second, exit play mode

We want to trigger that shaker from a feedback, so let’s establish our channel of communication, and let’s use a MMChannel asset for that, instead of a simple int.

  1. let’s first create a channel asset to have our feedback communicate with our shaker (of course if you already have some, you can skip this step), right ick in a folder in your project, and do Create > More Mountains > MMChannel. This will create a new MMChannel asset, which you can then rename. Let’s rename that one to MyFirstChannel.
  2. select your Cube, and on its MMScaleShaker, set ChannelMode to MMChannel, and drag MyFirstChannel into its MMChannelDefinition slot

We will now setup a feedback to trigger this same shake from a different object.

  1. create a new empty object, add a MMF Player component to it
  2. add a Transform > Scale Shake feedback to it
  3. unfold its Feedback Settings foldout, set Channel Mode to MMChannel, set MMChannelDefinition to MyFirstChannel
  4. press play in the editor, then press the green Play button on your MMF Player, the cube’s scale shakes

How to add a button to mute all sounds?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. in a scene containing a MMSoundManager
  3. create a UI button, press “+” on its OnClick action, drag your MMSoundManager in that slot, and select the MuteMaster method
  4. press play, pressing the UI button will mute all sounds playing through the MMSoundManager
  5. note that you can also do that via a MMFeedback (MMSoundManager Track Control, or MMSoundManager All Sounds Control), and you can also decide to save this setting via a feedback, see http://feel-docs.moremountains.com/mmsoundmanager.html for more info on that!

How to play a 3D sound?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. create a new, empty scene
  3. create a new, empty game object, add a MMSoundManager component to it
  4. create a new, empty game object, add a MMF Player to it, position it at 0,0,0
  5. add a MMSoundManager Sound feedback to it
  6. set its Sound/SFx to BeepLong1, SpatialBlend:1
  7. press play in the editor, then play your MMF Player, you’ll hear a beep
  8. move the MMF Player to 1000,0,0, play your MMF Player, you won’t hear it
  9. move the MMF Player to 25,0,0, play your MMF Player, you’ll hear it at reduced volume

How to trigger a flash feedback?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. create a new, empty scene, add a Canvas to it
  3. add an empty child to it, name it MyFlash, add a MMFlash component to it, stretch it so it covers your screen (one way to do that is to set your anchors to stretch, and set Left/Top/Right/Bottom to 0 on your RectTransform - but eventually how you do it is up to you, and depends on your Canvas and how your UI is setup), set the CanvasGroup component’s Alpha to 0
  4. create a new empty object, add a MMF Player to it, add a Camera > Flash feedback to it
  5. press play in the editor, then the green Play button on your MMF Player, tweak settings to your liking

How to play a MMF Player from an animation using Animation Events?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. create a new scene
  3. create a new cube, position it at 0,0,0
  4. add a MMF Player component to the cube, add a Sound feedback to it, set any audio clip in its Sfx slot, like FeelDuckQuack for example
  5. add a new Animator component to the cube
  6. create a new animator controller, call it CubeAnimatorController, drag it on the Animator component in its Controller slot
  7. open the Animation panel, create a new animation, call it BouncyCube
  8. add a new property to the animation, Transform:Position, press Record
  9. add a key at frame:0, with position to 0,0,0
  10. add a key at frame 20, with position 0,1,0
  11. copy frame 0, paste it at frame 60, you now have a cube that goes up and down
  12. put the cursor at frame 25, and press the AddEvent icon (right below the frame counter), in the inspector, in the Function dropdown, select PlayFeedbacks()
  13. press Play in the editor, your cube will bounce, and play a sound every time its animation passes frame 25. From there you can of course add and customize more feedbacks

How to migrate from a MMFeedbacks to a MMF_Player

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. open the FeelDuck demo scene
  3. in the Hierarchy, select the FeelDuckJumpStartFeedback
  4. in its MMFeedbacks inspector, unfold the Settings foldout towards the top of it
  5. at the bottom of that foldout, press the Convert To MMF_Player button
  6. a debug log to the console will tell you how it went, and will let you know if any feedbacks couldn’t be converted (that’d be the case for the old “Haptics” one for example, which doesn’t have an equivalent - there are new and better haptic feedbacks now though!)
  7. and that’s it, you’re done, press play, the duck will still quack when you start jumping, existing bindings have been preserved

How to setup a Post Processing Moving Filter

Maybe you’re familiar with the concept of camera filters, moving filters you can move in front of an actual, physical camera to add effects, diffusion, etc. Feel comes with tools to setup something similar if you want to. It’s a bit of work, but can offer a lot of features once done, as it’ll let you move a post processing volume (or more than one) over your camera. This is an easy way to transition smoothly between post processing effects. Like for all other feedbacks, you’ll find an example of that in the MMF_PlayerDemo scene, or you can follow the steps below (these use BiRP’s post processing stack v2, if you’re using another render pipeline, adapt the layer/volume accordingly, the filter will work on all pipelines):

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. in an empty scene, add a PostProcessLayer component to the MainCamera, VolumeBlending.Layer:Everything
  3. add an empty child object to the Camera at 0,0,0, name it MovingFilter
  4. add a BoxCollider to it, IsTrigger:true, then add a PostProcessVolume component to it, set its BlendDistance to 0.2 and pick the FeelBarbariansPostProcessingProfile as its Profile (it’s got a red vignette, you should see notice the difference as you pick it), then move that object to 0,3,0 so that it’s not covering the camera anymore.
  5. duplicate MovingFilter, name it BaseFilter, keep it a child of the MainCamera, and move it to 0,0,0 (so that it’s on top of the camera) and pick the FeelBlobPostProcessingProfile as its Profile (it’s got a purple vignette)
  6. now select your MovingFilter again, and add a MMPostProcessingMovingFilter to it, set its FilterOffset to 0,3, AddToInitialPosition:false, and on its PostProcessVolume component, set its Priority to 1
  7. create a new empty object in your scene, add a MMF Player to it, add a PPMovingFilter feedback
  8. press play in the editor, then press the green Play button on your MMF Player. You’ll notice a transition between the base post processing to the moving one. If you observe your scene in Scene view, you’ll notice as you play that feedback that the moving filter moves down to overlap the camera, taking priority

How to use a reference holder feedback?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. create a new empty scene, add a Cube to it at 0,0,0
  3. create a new empty, name it MyPlayer, add a MMF Player to it
  4. add a Transform > Position feedback to it, leave its AnimatePositionTarget empty, and instead set AutomatedTargetAcquisition.Mode:ClosestReferenceHolder
  5. add a Feedbacks > MMF Reference Holder feedback to it, set GameObjectReference:Cube
  6. press play in the editor, then the green play button on MyPlayer’s inspector, the Position feedback automatically grabs its target from the closest reference holder (we only have one so it’s an easy choice) and makes the Cube move

How to setup billboarding and a ghost camera?

Billboarding lets an object always face the camera. In these steps we set that up in a simple click, and also setup an easy to move ghost camera to try it out.

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. create a new, empty scene
  3. add a sprite renderer to it, position it at 0,0,0, set its Sprite to button-A
  4. add a MMBillboard component to it
  5. on your scene’s MainCamera, add a MMGhostCamera component
  6. press play, use WASD, space and C to move around, notice the A circle keeps facing your camera

How to setup a position shaker

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager, create a new, empty scene
  2. create a cube, position it at 0,0,0, add a MMPositionShaker component to it
  3. in its inspector, under ShakerSettings, set PlayOnAwake:true and PermanentShake:true
  4. press play, your cube will now shake at runtime. You can of course customize shake range and direction (and more) from its inspector
  5. now exit play mode, and set PlayOnAwake:false and PermanentShake:false, and we’ll create a feedback to trigger that movement on demand instead of having it always on
  6. create a new empty game object, name it “Player” and add a MMF Player component to it, then add a Transform > PositionShake feedback to it, via the “Add new feedback” dropdown
  7. under Feedback settings, you can define a Channel to target. Our shaker is already on Channel:0 so we’ll leave it like that
  8. press play in the editor, then press the green Play button on your MMF Player, the cube will shake
  9. still in play mode, let’s set ShakeSpeed:40, ShakeRange:1, Duration:0.75, ShakeMainDirection:1,0,0, DirectionalNoiseStrengthMax:1,1,1
  10. press the green play button again, your cube will now shake mostly horizontally, with some randomness on the direction, randomized every time you play it
  11. this component lets you customize things however you want, so feel free to explore it! You can also use the MMPositionShaker on rect transforms (make sure to set the appropriate Mode), and you’ll also find shakers for rotation and scale should you need them.

How to setup a MM Progress Bar?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. create a new empty scene, add a UI > Canvas to it
  3. create an empty child object under that Canvas at 0,0, name it MyBar
  4. add a UI > Image under MyBar at 0,0, name it BackgroundBar, set its color to black, set its width to 300, and its Pivot.x to 0
  5. duplicate MyBar, name it DelayedBarDecreasing, color:orange
  6. duplicate DelayedBarDecreasing, name it DelayedBarIncreasing, color:yellow
  7. duplicate DelayedBarIncreasing, name it ForegroundBar, color:green
  8. now that you have your four bars on top of each other (with the green one showing first), add a MMProgressBar component to MyBar (careful, there are two MMProgressBar components in Feel, one is used for NV demos only, you want the one with the colored inspector. Go with Add Component > More Mountains > Tools > GUI > MM Progress Bar)
  9. unfold the top inspector group (Bindings) and drag your ForegroundBar and DelayedBars into their corresponding slots there
  10. under the FillSettings foldout, set SetInitialFillValueOnStart to true, and set InitialFillValue to 1, BarFillMode:FixedDuration
  11. press play in the editor, then at the bottom of the inspector, under the Debug foldout, press the Minus10 / Plus10Percent buttons, congratulations, you’ve got a working progress bar!

Controlling our bar values via script

Debug controls are fine and all, but you’ll probably want some script of yours to drive the values of the bar. Thanks to the progress bar API methods, that’s made very easy, all you’ll need will be a reference to the bar, and call one-liner methods. Let’s add the following class to your project (create a new class, name it TestBar, paste the following in it)

using UnityEngine;
using MoreMountains.Tools;

public class TestBar : MonoBehaviour
{
	// we'll want to drag and drop a progress bar into that slot to get a reference to our bar
	public MMProgressBar TargetProgressBar;
	// a value between 0 and 100, maybe in our game that'd be our main character's health value
	[Range(0f, 100f)] public float Value;
	// a test button to display in our inspector and let us call the ChangeBarValue method
	[MMInspectorButton("ChangeBarValue")] public bool ChangeBarValueBtn;
	
	void ChangeBarValue()
	{
		TargetProgressBar.UpdateBar(Value, 0f, 100f);
	}
}
  1. then, create a new empty object in the scene, add the TestBar component to it, drag MyBar into its TargetProgressBar slot
  2. press play in the editor, then set some Value using the slider in the TestBar inspector, and press the ChangeBarValue button

Of course in your own game, you probably would have that UpdateBar call in a method you call when your character takes damage, or uses its mana, whenever you want to update your bar’s value.

How to add a squash and stretch behavior to an object?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. create a new, empty scene
  3. create a new, empty object, name it TopLevel, position it at 0,0,0
  4. then, under it, create an empty child object, also at 0,0,0, name it SquashAndStretch, add a MMSquashAndStetch component to it
  5. finally create a cube, parent it under SquashAndStretch (you should now have 3 levels of hierarchy) at 0,0,0 too
  6. press play in your editor, select the TopLevel object and move it around, it will automatically squash & stretch

How to setup a UI element hover effect?

Let’s say you want to have a UI element grow bigger when the mouse cursor passes over it, and have it shrink back to its normal size when the mouse exits it. That’s easy to setup using feedbacks :

  1. create a new class, name it TestPointer, paste the following code into it :
using MoreMountains.Feedbacks;
using UnityEngine;
using UnityEngine.EventSystems;

public class TestPointer : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
	public MMF_Player MyPlayer;

	public void OnPointerEnter(PointerEventData eventData)
	{
		MyPlayer.Direction = MMFeedbacks.Directions.TopToBottom;
		MyPlayer.PlayFeedbacks();
	}

	public void OnPointerExit(PointerEventData eventData)
	{
		MyPlayer.Direction = MMFeedbacks.Directions.BottomToTop;
		MyPlayer.PlayFeedbacks();
	}
}
  1. in a new, empty scene, add a UI Button, name it MyButton, position it at 0,0,0, add a TestPointer component to it
  2. add an empty child to the button, name it HoverFeedback, add a MMF Player to it
  3. add a Transform > Scale feedback to it, AnimateScaleTarget:MyButton, set all Tweens (X,Y,Z) to MMTween>EaseInCubic, AnimateScaleDuration:3
  4. select MyButton again, drag the HoverFeedback into its TestPointer’s inspector’s MyPlayer slot
  5. press play in the editor, put your cursor above the button, it’ll grow over 3s, move it out, it’ll shrink back

How to wait for a MMF Player to finish before executing the rest of a coroutine?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. in a new scene, add a Cube
  3. on a new empty object, add a MMF Player, add a Position feedback to it, set the Cube as its AnimatePositionTarget, set AnimatePositionDuration:4
  4. on a new object, add the TestCoroutine component (see below), drag the MMF Player into its MyPlayer slot
  5. press play, press the TestCoPlay button on it, the cube will start moving and a first debug log will be displayed in the console. After 4 seconds, as the MMF Player finishes playing, the end of the coroutine will run, displaying a new entry in the console.
using System.Collections;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine;

public class TestCoroutine : MonoBehaviour
{
	public MMF_Player MyPlayer;

	[MMFInspectorButton("TestCoPlay")]
	public bool TestCoPlayBtn;

	private void TestCoPlay()
	{
		StartCoroutine(TestCoPlayCo());
	}

	private IEnumerator TestCoPlayCo()
	{
		MMDebug.DebugLogTime("start");
		yield return MyPlayer.PlayFeedbacksCoroutine(this.transform.position);
		MMDebug.DebugLogTime("end");
	}
}

How to disable a certain type of feedback?

Sometimes you want to give players control over what type of feedbacks they’ll get to experience. For instance, it’s common to offer an option to turn down screen shakes, as it can be a problem for people with disabilities, for example. With Feel, doing so is very easy!

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. open the Toaster demo scene
  3. create a new class in your project, name it ImpulseDisabler, and replace its contents with this :
using MoreMountains.FeedbacksForThirdParty;
using UnityEngine;

public class ImpulseDisabler : MonoBehaviour
{
	public void DisableAllImpulses()
	{
		MMF_CinemachineImpulse.FeedbackTypeAuthorized = false;
	}

	public void EnableAllImpulses()
	{
		MMF_CinemachineImpulse.FeedbackTypeAuthorized = true;
	}
}
  1. in your scene, create a new button (GameObject > UI > Button), and position it at 0,0,0 (yes it’s ugly and in the middle of the screen, feel free to put it elsewhere)
  2. add your newly created ImpulseDisabler component to this button
  3. in the button inspector, under OnClick, add a new entry, drag the ImpulseDisabler component into the slot that appears, and select its ImpulseDisabler.DisableAllImpulses function
  4. press play in the editor, then press the CM Impulse button in the sidebar of the scene, the screen will shake, now press the button you created, then the CM Impulse button again, the screen won’t shake anymore
  5. that’s it, you now know how to disable (or enable) a feedback of any type with a single line. You can do so for all feedbacks, simply target their specific type!

How to load a scene additively using a feedback?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. create a new, empty scene
  3. create a new empty object, name it Feedback, add a MMF Player component to it, then via its “Add new feedback” dropdown, add a Scene > Load Scene feedback
  4. set its SceneLoading/DestinationSceneName to FeelDuck (one of the Feel demos)
  5. open your build settings (File > Build Settings), then drag the FeelDuck scene from your Project view into the BuildSettings’ ScenesInBuild panel, then close the window
  6. do the same with the MMAdditiveLoadingScreen scene
  7. enter play mode in your editor, then press the green Play button on your MMF Player. The loading screen will appear, and transition to the new scene after it loads

How to setup a squash and stretch feedback?

  1. in Unity 2020.3.48f1 (or +), create a new project and import Feel v3.16 (or +) via the Package Manager
  2. create a new empty, name it Container, reset its transform
  3. create a new Cube, name it Model, parent it under Container, position it at 0,0,0
  4. create a new empty, name it Player, add a MMF Player to it
  5. add a Transform > Squash & Stretch feedback to it, and drag Container into its SquashAndStretchTarget slot
  6. press play in the editor, then the green Play button on your MMF Player