Trying to get my OnTriggerEvent to run more than once
Basically I am working on a game where when the player enters the area of the enemy (i'm using a sphere collider) the OnTriggerEvent method is run so that the enemy makes a noise, which works fine, the problem is when I leave the area and go back inside, it wont do it again, the debug log still detects me as being inside the area even when I have left, how do I make it so it'll work on re-entry too? Here's the script just in case.

Create a Debug.Log inside the if statement and post your Audio$$anonymous$$anager code.
Also, don't print your code, copy paste it here and don't forget to use the 101010 button to format it correctly.
The only code for the audio manager itself is the cs script that comes with the program, which is never altered. However I can show you my hierarchy of my audio components in cse that's useful. Just in case also, here's my Audio manager cs file:
using UnityEngine;
using System.Collections;
public static class Audio$$anonymous$$anager
{
private static void playAudio(string eventName)
{
//AUDIO: without position
Fabric.Event$$anonymous$$anager.Instance.PostEvent(eventName);
}
private static void playAudioWithPosition(string eventName, GameObject ob)
{
//AUDIO: with position
Fabric.Event$$anonymous$$anager.Instance.PostEvent(eventName, ob);
}
public static bool FabricLoaded {get { return Fabric.Event$$anonymous$$anager.Instance; }}
public static void PlaySound(string n)
{
LoadFabric();
if (FabricLoaded)
playAudio(n);
}
public static void PlaySound(string n, GameObject ob)
{
LoadFabric();
if (FabricLoaded)
playAudioWithPosition(n, ob);
}
public static void StopSound(string n)
{
Fabric.Event$$anonymous$$anager.Instance.PostEvent(n, Fabric.EventAction.StopAll);
}
public static void FadeOut$$anonymous$$usic(string n) {
// fade out the music!
Fabric.Component component = Fabric.Fabric$$anonymous$$anager.Instance.GetComponentByName(n);
if (component != null) {
component.FadeOut(0.1f, 0.5f);
}
}
public static void SetDialogLine(string dialogEvent, string componentName)
{
Fabric.Event$$anonymous$$anager.Instance.PostEvent(componentName, Fabric.EventAction.SetAudioClipReference, dialogEvent);
}
public static void LoadFabric()
{
if (FabricLoaded) { // || Application.isLoadingLevel) {
return;
}
Application.LoadLevelAdditive("_Audio_");
}
public static bool IsSoundStillPlaying ( string n)
{
return Fabric.Event$$anonymous$$anager.Instance.IsEventActive(n, null);
}
}
And here's the audio hierarchy:

Fabric.Event$$anonymous$$anager.Instance.PostEvent(eventName, ob);
That line leads to another script, that may be the source of your problem.
But, that code is really redundant, creating several funcions calls just to play and audio, I believe that you can create a more efficient way to do that.
If you REALLY want to use that sound manager, post the code of your Event$$anonymous$$anager, as there is nothing wrong with what you posted until now.
Besides the info that brunocoimbra gave, I would also recommend adding the following to see if it is registering that your player actually leaves.
void OnTriggerExit(Collider objectCollided)
{
if (objectCollided.gameObject.tag == "Player")
{
Debug.Log("Player has left area")
}
}
Honestly I don't see why this wouldn't work unless there is something in your Audio$$anonymous$$anager script interfering.
Hmm, the debug log did put out that message when I ran away, so I guess it is the audio component that's at fault.
Your answer
Follow this Question
Related Questions
What is the 3D equivalent of using Physics2D.OverlapArea to check for if a character is grounded? 2 Answers
2D Platformer Character Acts Weird When Collide Side of a Platform 0 Answers
App works fine on PC but not on android 0 Answers
Rotating Gameobject not Colliding 1 Answer
Edge collider BoxCast issue 0 Answers
