Playing Audio from Unity with NoesisGUI
Posted: 31 Oct 2022, 15:54
Hello guys, I have a question regarding audio in NoesisGUI. I'm workin on a system that is similar to a communication wheel where there are different options when clicked such as playing voicelines and eventually generating pings in world. Right now I am focused on implementing different sound queues for my project and I was wondering how I would go about integrating Unity's audio system into the XAML. For example, on the radial menu demo, you have this:
I was wondering if it were possible to bind Unity'd AudioClip, to this. So I have something like this instead
The view model that I am using is a Monobehaviour but I am wondering if I can use Unity's Audio system for some sort of XAML click event and how I would go about doing that?
I'm not sure if the " PlaySoundAction" on the XAML is using the same audio source as Unity (I assume they would be different)?
Any help is appreciated
Code: Select all
<b:DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}}" Value="True">
<b:PlaySoundAction Source="Sounds/AudioName.mp3" Volume="1.0" IsEnabled="False"/>
</b:DataTrigger>
Code: Select all
<b:DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}}" Value="True">
<b:PlaySoundAction Source="{Binding AudioFile}" Volume="1.0" IsEnabled="False"/>
</b:DataTrigger>
public class Callout
{
public string Name { get; set; }
public ImageSource Icon { get; set; }
public AudioClip AudioFile { get; set; }
}
The view model that I am using is a Monobehaviour but I am wondering if I can use Unity's Audio system for some sort of XAML click event and how I would go about doing that?
I'm not sure if the " PlaySoundAction" on the XAML is using the same audio source as Unity (I assume they would be different)?
Any help is appreciated