#AudioSource stop
1 messages · Page 1 of 1 (latest)
h
h
well I'm not sure what the issue is, but have you considered making the AudioManager script a public static variable, so you could just do AudioManager.Stop("Theme");
Maybe how you're finding the AudioManager has to do it with 🤷♂️
idek it can find and play the playerdeath sound but it says Assets\Scripts\playerCollision.cs(16,46): error CS1061: 'AudioManager' does not contain a definition for 'Stop' and no accessible extension method 'Stop' accepting a first argument of type 'AudioManager' could be found (are you missing a using directive or an assembly reference?)
AudioManager is a script right?
does it have a public function called Play(), and Stop()?
you're trying to call a method in your AudioManager script called Stop(). If you didn't make one you get this error
You've probably confused it with AudioSource.Stop()
however, what I was talking about earlier, is doing this:
In your AudioManager script, put a line at the top that says public static AudioManager instance;
then in Awake(), instance = this
i was getting confused with audiosource yeah
o ok
(I'm talking about how you can reference scripts without having to do FindObjectOfType<AudioManager>())
yeah
Then from any script in your game you can reference the AudioManager by doing AudioManager.instance.Stop()
does that make sense?
yeah
so i just define a public audiomanager instead of having to find one?
then easily ref it