Hi everyone!
1. On the Third Person Character Controller
2. Unity 2021.2.17f
3. If you add an audio clip to the Shield component and test the impact the audio clip does not get played. This is because there is no code in the Shield component that calls the PlayAudioClip method on the Animator Audio Set. Once I added the code to do so the audio played as expected. Below is the code that I added.
4.
a. Add an audio clip to a shield component
b. impact the shield with a weapon
5. N/A
Code I added to make it work. I included the whole if statement though I only added the two lines that I have detailed.
if (m_ApplyImpact) {
m_HasImpact = true;
m_ImpactAnimatorAudioStateSet.StartStopStateSelection(true);
m_ImpactAnimatorAudioStateSet.NextState();
*First Line* var visibleItem = m_Item.GetVisibleObject() != null ? m_Item.GetVisibleObject() : m_Character;
* Second Line* m_ImpactAnimatorAudioStateSet.PlayAudioClip(visibleItem);
EventHandler.ExecuteEvent(m_Character, "OnShieldImpact", this, source);
}
1. On the Third Person Character Controller
2. Unity 2021.2.17f
3. If you add an audio clip to the Shield component and test the impact the audio clip does not get played. This is because there is no code in the Shield component that calls the PlayAudioClip method on the Animator Audio Set. Once I added the code to do so the audio played as expected. Below is the code that I added.
4.
a. Add an audio clip to a shield component
b. impact the shield with a weapon
5. N/A
Code I added to make it work. I included the whole if statement though I only added the two lines that I have detailed.
if (m_ApplyImpact) {
m_HasImpact = true;
m_ImpactAnimatorAudioStateSet.StartStopStateSelection(true);
m_ImpactAnimatorAudioStateSet.NextState();
*First Line* var visibleItem = m_Item.GetVisibleObject() != null ? m_Item.GetVisibleObject() : m_Character;
* Second Line* m_ImpactAnimatorAudioStateSet.PlayAudioClip(visibleItem);
EventHandler.ExecuteEvent(m_Character, "OnShieldImpact", this, source);
}