Once configured, you can trigger the PlayFeedbacks method using two primary methods:
1. Via Unity Events
Drag and drop your MMFeedbacks GameObject into the slot of a Unity Event (such as a UI Button's OnClick event) and select the PlayFeedbacks method.
2. Via C# Code
Declare a public MMFeedbacks variable in your script, assign it in the Inspector, and call its methods when needed.
Available Methods:
PlayFeedbacks(): Starts the feedback sequence.Initialize(): Prepares the feedbacks.StopFeedbacks(): Stops currently playing feedbacks.ResetFeedbacks(): Resets feedbacks to their initial state.
Note: You can also test these methods at runtime directly from the Inspector's bottom button bar or test individual feedbacks using the dropdown on each feedback's title bar.
using UnityEngine;
using MoreMountains.Feedbacks;
public class CharacterJump : MonoBehaviour
{
// We declare a public MMFeedbacks reference, which we'll set from our CharacterJump inspector
public MMFeedbacks JumpFeedback;
public void Jump()
{
// Trigger the feedback when the jump occurs
JumpFeedback.PlayFeedbacks();
}
}