hello!
i'm trying to make a proximity based SFX, where an NPC calls for the player when he enters his collider.
that works fine. the problem is, that when the player starts the interaction, i want the call audio clip to stop so that the conversation wouldn't overlap. i've created a script that handles the audio, and i'm trying to test the simple .Stop() function with an input, but the clip won't stop. adding the script.
character naming is because i'm re-creating a witcher 2 quest for practice
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ElthonSFX : MonoBehaviour
{
public AudioSource elthonCallingGeralt = null;//component is inserted via inspector
void Start()
{
}
void Update()
{
if (Input.GetKeyDown(KeyCode.O))//for testing .Stop()
{
StopCalling();
}
}
public void CallGeralt()//called from another script via OntriggerEnter()
{
AudioSource.PlayClipAtPoint(elthonCallingGeralt.clip, transform.position); //works
}
public void StopCalling()
{
elthonCallingGeralt.Stop();//doesn't work
print("stoppedCalling");//printing works
}
}
thanks