Play sound when equipment is dropped

Niroan

Member
Hello,

I want to play a sound when my players drop and item in equipment slot.
And i want to play another sound when the player drag and drops a item from equipment to inventory.
Also i want a sound when my user clicks the crafting button to make and item
 
I actually haven't thought too much about playing Audio at those points, so let me know if any of the advice below isn't enough, I'll try to look into those things for the next update.

For dropping the item to equipment slot or inventory slot you could play a sound using a custom drop action. Multiple drop actions can be used at the same time.
For crafting you could either create a custom Crafting Menu, or perhaps simply add an OnClick listener on the button. If you make a custom CraftingMenu you can override the "OnCraftCompletefunction" from CraftingMenuBase.

Let me know if some of these aren't enough to achieve what you want, I'll try to implement something easier in the next big update when our new Audio System comes out with UCC and UIS.
 
I actually haven't thought too much about playing Audio at those points, so let me know if any of the advice below isn't enough, I'll try to look into those things for the next update.

For dropping the item to equipment slot or inventory slot you could play a sound using a custom drop action. Multiple drop actions can be used at the same time.
For crafting you could either create a custom Crafting Menu, or perhaps simply add an OnClick listener on the button. If you make a custom CraftingMenu you can override the "OnCraftCompletefunction" from CraftingMenuBase.

Let me know if some of these aren't enough to achieve what you want, I'll try to implement something easier in the next big update when our new Audio System comes out with UCC and UIS.
How and where? I spend 4 days reconfigurating the UIS cause of Update. I rather NOT Update again.
The sounds system is extremly complicated matter i just want and audio source where i have my Mixing group attached. Then dragging the audio clip to Play.
Is there not and event for “Crafting”
 
For Drop Actions you can learn more here:
It explains how to create your own custom drop actions, you can create one that plays a sound however you want.

Unfortunatly I haven't added an event when crafting. I'll do that right now.

In the CraftingMenuBase script you'll want to add a new class:
Code:
[Serializable]
public class BoolUnityEvent : UnityEvent<bool> { }

Then you'll need to add a new field inside the CraftingMenuBase class:
Code:
[Tooltip("An Event called when the crafting is done.")]
[SerializeField] protected BoolUnityEvent m_OnCraftComplete;

Finally change the OnCraftComplete of the CraftingMenuBase script:
Code:
/// <summary>
/// When the Craft has been complete send an event.
/// </summary>
/// <param name="result">The crafting Result.</param>
/// <param name="selectedRecipe">The selected Recipe.</param>
/// <param name="inventory">The Inventory where the item was added.</param>
/// <param name="quantity">The quantity crafted.</param>
public virtual void OnCraftComplete(CraftingResult result, CraftingRecipe selectedRecipe, Inventory inventory, int quantity)
{
    m_OnCraftComplete.Invoke(result.Success);
}

All these changes will be kept for the next update.
With that change you'll be able to hook up your own script to that event to play a sound when the crafting is done. And you'll even be able to play a different sound depending if it failed or not to craft (requires custom craftin processor, by default all crafting succeeds).

I hope that helps :)
 
Top