Hello!
I’m putting this in the Physics forum, cause even though it has to do with music triggers, I think the problem is with Physics.
Here’s my issue:
I’m using the script below to set various Music States in Wwise. When the player enters Music Region A, it triggers Wwise to change the state to Music A, etc. The system works flawlessly when the player is walking/running in and out from these box colliders. The problem is when the player teleports from one region to another. Sometimes Unity recognize the enter trigger (On Trigger Enter State) and sometimes it doesn’t. It seems completely random. To add to my confusion, the EXIT trigger (On Trigger Exit State) trigger always works 100% of the time.
Attached is a screenshot of how I’ve set up the trigger region.
I’ve tried adding a Rigidbody to this object (with various settings on the Is Kinematic / Collision Detection options) with no effect.
Any suggestions would be very appreciated! Thanks!
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SetMusicState : MonoBehaviour {
public AK.Wwise.State OnTriggerEnterState;
public AK.Wwise.State OnTriggerExitState;
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player")) {
OnTriggerEnterState.SetValue();
}
}
private void OnTriggerExit(Collider other)
{
if (other.CompareTag("Player"))
{
OnTriggerExitState.SetValue();
}
}
}